Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Fork a subset of ash/shelf for use in mash.
Browse files Browse the repository at this point in the history
Fork Shelf View, Model, Button, TooltipManager, etc.
These provide a baseline of ash/shelf-like functionality.
(show open mash windows, support reordering, tooltips, etc.)

Restructure some ownership patterns (eg. shelf owns model).
Minimal code refactoring, removal and commenting.
(attempt to minimize diff, keep/stub some features)

TODO: Restore missing functionality/tests.

BUG=557406
TEST=mojo:mash_shell's shelf starts looking more like ash.
R=sky@chromium.org,bungeman@google.com

Review URL: https://codereview.chromium.org/1585363002

Cr-Commit-Position: refs/heads/master@{#371866}
  • Loading branch information
msw authored and Commit bot committed Jan 27, 2016
1 parent 58c568b commit 16ae028
Show file tree
Hide file tree
Showing 18 changed files with 4,229 additions and 80 deletions.
17 changes: 17 additions & 0 deletions mash/shelf/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,25 @@ import("//build/config/ui.gni")
import("//mojo/public/mojo_application.gni")
import("//mojo/public/tools/bindings/mojom.gni")

# TODO(msw): Port unit/app tests: model, view, tooltip_manager, etc.
mojo_native_application("shelf") {
sources = [
"main.cc",
"shelf_application.cc",
"shelf_application.h",
"shelf_button.cc",
"shelf_button.h",
"shelf_button_host.h",
"shelf_constants.cc",
"shelf_constants.h",
"shelf_item_types.cc",
"shelf_item_types.h",
"shelf_model.cc",
"shelf_model.h",
"shelf_model_observer.h",
"shelf_tooltip_manager.cc",
"shelf_tooltip_manager.h",
"shelf_types.h",
"shelf_view.cc",
"shelf_view.h",
]
Expand All @@ -24,9 +38,12 @@ mojo_native_application("shelf") {
"//mojo/services/tracing/public/cpp",
"//mojo/shell/public/cpp",
"//skia",
"//ui/accessibility",
"//ui/aura",
"//ui/resources",
"//ui/views",
"//ui/views/mus:for_mojo_application",
"//ui/wm",
]

resources = [ "$root_out_dir/views_mus_resources.pak" ]
Expand Down
3 changes: 3 additions & 0 deletions mash/shelf/DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include_rules = [
"+skia",
]
6 changes: 4 additions & 2 deletions mash/shelf/shelf_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ void ShelfApplication::Initialize(mojo::ApplicationImpl* app) {
aura_init_.reset(new views::AuraInit(app, "views_mus_resources.pak"));
views::WindowManagerConnection::Create(app);

// Construct the shelf using a container tagged for positioning by the WM.
views::Widget* widget = new views::Widget;
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
params.delegate = new ShelfView(app);

std::map<std::string, std::vector<uint8_t>> properties;
properties[mash::wm::mojom::kWindowContainer_Property] =
mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert(
Expand All @@ -41,6 +40,9 @@ void ShelfApplication::Initialize(mojo::ApplicationImpl* app) {
params.native_widget = new views::NativeWidgetMus(
widget, app->shell(), window, mus::mojom::SurfaceType::DEFAULT);
widget->Init(params);
widget->SetContentsView(new ShelfView(app));
// Call CenterWindow to mimic Widget::Init's placement with a widget delegate.
widget->CenterWindow(widget->GetContentsView()->GetPreferredSize());
widget->Show();
}

Expand Down
Loading

0 comments on commit 16ae028

Please sign in to comment.