| Index: ash/shell/window_type_launcher.cc
|
| diff --git a/ash/shell/window_type_launcher.cc b/ash/shell/window_type_launcher.cc
|
| index a1961f9892056f435ee02ed5bb091104600ca4af..5e52da2cfd186df5560362f4f124de4d612e510f 100644
|
| --- a/ash/shell/window_type_launcher.cc
|
| +++ b/ash/shell/window_type_launcher.cc
|
| @@ -42,10 +42,7 @@ namespace shell {
|
|
|
| namespace {
|
|
|
| -SkColor g_colors[] = { SK_ColorRED,
|
| - SK_ColorYELLOW,
|
| - SK_ColorBLUE,
|
| - SK_ColorGREEN };
|
| +SkColor g_colors[] = {SK_ColorRED, SK_ColorYELLOW, SK_ColorBLUE, SK_ColorGREEN};
|
| int g_color_index = 0;
|
|
|
| class ModalWindow : public views::WidgetDelegateView,
|
| @@ -54,8 +51,8 @@ class ModalWindow : public views::WidgetDelegateView,
|
| explicit ModalWindow(ui::ModalType modal_type)
|
| : modal_type_(modal_type),
|
| color_(g_colors[g_color_index]),
|
| - open_button_(new views::LabelButton(this,
|
| - base::ASCIIToUTF16("Moar!"))) {
|
| + open_button_(
|
| + new views::LabelButton(this, base::ASCIIToUTF16("Moar!"))) {
|
| ++g_color_index %= arraysize(g_colors);
|
| open_button_->SetStyle(views::Button::STYLE_BUTTON);
|
| AddChildView(open_button_);
|
| @@ -63,9 +60,8 @@ class ModalWindow : public views::WidgetDelegateView,
|
| ~ModalWindow() override {}
|
|
|
| static void OpenModalWindow(aura::Window* parent, ui::ModalType modal_type) {
|
| - views::Widget* widget =
|
| - views::Widget::CreateWindowWithParent(new ModalWindow(modal_type),
|
| - parent);
|
| + views::Widget* widget = views::Widget::CreateWindowWithParent(
|
| + new ModalWindow(modal_type), parent);
|
| widget->GetNativeView()->SetName("ModalWindow");
|
| widget->Show();
|
| }
|
| @@ -78,9 +74,8 @@ class ModalWindow : public views::WidgetDelegateView,
|
| void Layout() override {
|
| gfx::Size open_ps = open_button_->GetPreferredSize();
|
| gfx::Rect local_bounds = GetLocalBounds();
|
| - open_button_->SetBounds(
|
| - 5, local_bounds.bottom() - open_ps.height() - 5,
|
| - open_ps.width(), open_ps.height());
|
| + open_button_->SetBounds(5, local_bounds.bottom() - open_ps.height() - 5,
|
| + open_ps.width(), open_ps.height());
|
| }
|
|
|
| // Overridden from views::WidgetDelegate:
|
| @@ -107,8 +102,7 @@ class ModalWindow : public views::WidgetDelegateView,
|
|
|
| class NonModalTransient : public views::WidgetDelegateView {
|
| public:
|
| - NonModalTransient()
|
| - : color_(g_colors[g_color_index]) {
|
| + NonModalTransient() : color_(g_colors[g_color_index]) {
|
| ++g_color_index %= arraysize(g_colors);
|
| }
|
| ~NonModalTransient() override {}
|
| @@ -171,43 +165,51 @@ void AddViewToLayout(views::GridLayout* layout, views::View* view) {
|
| } // namespace
|
|
|
| void InitWindowTypeLauncher() {
|
| - views::Widget* widget =
|
| - views::Widget::CreateWindowWithContextAndBounds(
|
| - new WindowTypeLauncher,
|
| - Shell::GetPrimaryRootWindow(),
|
| - gfx::Rect(120, 150, 300, 410));
|
| + views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
|
| + new WindowTypeLauncher, Shell::GetPrimaryRootWindow(),
|
| + gfx::Rect(120, 150, 300, 410));
|
| widget->GetNativeView()->SetName("WindowTypeLauncher");
|
| ::wm::SetShadowType(widget->GetNativeView(), ::wm::SHADOW_TYPE_RECTANGULAR);
|
| widget->Show();
|
| }
|
|
|
| WindowTypeLauncher::WindowTypeLauncher()
|
| - : create_button_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Create Window"))),
|
| - panel_button_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Create Panel"))),
|
| + : create_button_(
|
| + new views::LabelButton(this, base::ASCIIToUTF16("Create Window"))),
|
| + panel_button_(
|
| + new views::LabelButton(this, base::ASCIIToUTF16("Create Panel"))),
|
| create_nonresizable_button_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Create Non-Resizable Window"))),
|
| - bubble_button_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Create Pointy Bubble"))),
|
| - lock_button_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Lock Screen"))),
|
| - widgets_button_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Show Example Widgets"))),
|
| + this,
|
| + base::ASCIIToUTF16("Create Non-Resizable Window"))),
|
| + bubble_button_(
|
| + new views::LabelButton(this,
|
| + base::ASCIIToUTF16("Create Pointy Bubble"))),
|
| + lock_button_(
|
| + new views::LabelButton(this, base::ASCIIToUTF16("Lock Screen"))),
|
| + widgets_button_(
|
| + new views::LabelButton(this,
|
| + base::ASCIIToUTF16("Show Example Widgets"))),
|
| system_modal_button_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Open System Modal Window"))),
|
| + this,
|
| + base::ASCIIToUTF16("Open System Modal Window"))),
|
| window_modal_button_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Open Window Modal Window"))),
|
| + this,
|
| + base::ASCIIToUTF16("Open Window Modal Window"))),
|
| child_modal_button_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Open Child Modal Window"))),
|
| + this,
|
| + base::ASCIIToUTF16("Open Child Modal Window"))),
|
| transient_button_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Open Non-Modal Transient Window"))),
|
| + this,
|
| + base::ASCIIToUTF16("Open Non-Modal Transient Window"))),
|
| examples_button_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Open Views Examples Window"))),
|
| - show_hide_window_button_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Show/Hide a Window"))),
|
| + this,
|
| + base::ASCIIToUTF16("Open Views Examples Window"))),
|
| + show_hide_window_button_(
|
| + new views::LabelButton(this,
|
| + base::ASCIIToUTF16("Show/Hide a Window"))),
|
| show_web_notification_(new views::LabelButton(
|
| - this, base::ASCIIToUTF16("Show a web/app notification"))) {
|
| + this,
|
| + base::ASCIIToUTF16("Show a web/app notification"))) {
|
| create_button_->SetStyle(views::Button::STYLE_BUTTON);
|
| panel_button_->SetStyle(views::Button::STYLE_BUTTON);
|
| create_nonresizable_button_->SetStyle(views::Button::STYLE_BUTTON);
|
| @@ -226,12 +228,8 @@ WindowTypeLauncher::WindowTypeLauncher()
|
| layout->SetInsets(5, 5, 5, 5);
|
| SetLayoutManager(layout);
|
| views::ColumnSet* column_set = layout->AddColumnSet(0);
|
| - column_set->AddColumn(views::GridLayout::LEADING,
|
| - views::GridLayout::CENTER,
|
| - 0,
|
| - views::GridLayout::USE_PREF,
|
| - 0,
|
| - 0);
|
| + column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER,
|
| + 0, views::GridLayout::USE_PREF, 0, 0);
|
| AddViewToLayout(layout, create_button_);
|
| AddViewToLayout(layout, panel_button_);
|
| AddViewToLayout(layout, create_nonresizable_button_);
|
| @@ -248,8 +246,7 @@ WindowTypeLauncher::WindowTypeLauncher()
|
| set_context_menu_controller(this);
|
| }
|
|
|
| -WindowTypeLauncher::~WindowTypeLauncher() {
|
| -}
|
| +WindowTypeLauncher::~WindowTypeLauncher() {}
|
|
|
| void WindowTypeLauncher::OnPaint(gfx::Canvas* canvas) {
|
| canvas->FillRect(GetLocalBounds(), SK_ColorWHITE);
|
| @@ -352,8 +349,7 @@ void WindowTypeLauncher::ShowContextMenuForView(
|
| const gfx::Point& point,
|
| ui::MenuSourceType source_type) {
|
| MenuItemView* root = new MenuItemView(this);
|
| - root->AppendMenuItem(COMMAND_NEW_WINDOW,
|
| - base::ASCIIToUTF16("New Window"),
|
| + root->AppendMenuItem(COMMAND_NEW_WINDOW, base::ASCIIToUTF16("New Window"),
|
| MenuItemView::NORMAL);
|
| root->AppendMenuItem(COMMAND_TOGGLE_FULLSCREEN,
|
| base::ASCIIToUTF16("Toggle FullScreen"),
|
| @@ -361,9 +357,7 @@ void WindowTypeLauncher::ShowContextMenuForView(
|
| // MenuRunner takes ownership of root.
|
| menu_runner_.reset(new MenuRunner(
|
| root, MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU));
|
| - if (menu_runner_->RunMenuAt(GetWidget(),
|
| - NULL,
|
| - gfx::Rect(point, gfx::Size()),
|
| + if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(point, gfx::Size()),
|
| views::MENU_ANCHOR_TOPLEFT,
|
| source_type) == MenuRunner::MENU_DELETED) {
|
| return;
|
|
|