| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/shell/window_type_launcher.h" | 5 #include "ash/shell/window_type_launcher.h" |
| 6 | 6 |
| 7 #include "ash/shell_window_ids.h" | 7 #include "ash/shell_window_ids.h" |
| 8 #include "ash/shell/example_factory.h" | 8 #include "ash/shell/example_factory.h" |
| 9 #include "ash/shell/toplevel_window.h" | 9 #include "ash/shell/toplevel_window.h" |
| 10 #include "ash/wm/shadow_types.h" | 10 #include "ash/wm/shadow_types.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 DISALLOW_COPY_AND_ASSIGN(NonModalTransient); | 138 DISALLOW_COPY_AND_ASSIGN(NonModalTransient); |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 } // namespace | 141 } // namespace |
| 142 | 142 |
| 143 void InitWindowTypeLauncher() { | 143 void InitWindowTypeLauncher() { |
| 144 views::Widget* widget = | 144 views::Widget* widget = |
| 145 views::Widget::CreateWindowWithBounds(new WindowTypeLauncher, | 145 views::Widget::CreateWindowWithBounds(new WindowTypeLauncher, |
| 146 gfx::Rect(120, 150, 400, 300)); | 146 gfx::Rect(120, 150, 400, 300)); |
| 147 widget->GetNativeView()->SetName("WindowTypeLauncher"); | 147 widget->GetNativeView()->SetName("WindowTypeLauncher"); |
| 148 aura_shell::internal::SetShadowType(widget->GetNativeView(), | 148 ash::internal::SetShadowType(widget->GetNativeView(), |
| 149 aura_shell::internal::SHADOW_TYPE_NONE); | 149 ash::internal::SHADOW_TYPE_NONE); |
| 150 widget->Show(); | 150 widget->Show(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 WindowTypeLauncher::WindowTypeLauncher() | 153 WindowTypeLauncher::WindowTypeLauncher() |
| 154 : ALLOW_THIS_IN_INITIALIZER_LIST(create_button_( | 154 : ALLOW_THIS_IN_INITIALIZER_LIST(create_button_( |
| 155 new views::NativeTextButton(this, ASCIIToUTF16("Create Window")))), | 155 new views::NativeTextButton(this, ASCIIToUTF16("Create Window")))), |
| 156 ALLOW_THIS_IN_INITIALIZER_LIST(create_nonresizable_button_( | 156 ALLOW_THIS_IN_INITIALIZER_LIST(create_nonresizable_button_( |
| 157 new views::NativeTextButton( | 157 new views::NativeTextButton( |
| 158 this, ASCIIToUTF16("Create Non-Resizable Window")))), | 158 this, ASCIIToUTF16("Create Non-Resizable Window")))), |
| 159 ALLOW_THIS_IN_INITIALIZER_LIST(bubble_button_( | 159 ALLOW_THIS_IN_INITIALIZER_LIST(bubble_button_( |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 250 |
| 251 bool WindowTypeLauncher::CanResize() const { | 251 bool WindowTypeLauncher::CanResize() const { |
| 252 return true; | 252 return true; |
| 253 } | 253 } |
| 254 | 254 |
| 255 string16 WindowTypeLauncher::GetWindowTitle() const { | 255 string16 WindowTypeLauncher::GetWindowTitle() const { |
| 256 return ASCIIToUTF16("Examples: Window Builder"); | 256 return ASCIIToUTF16("Examples: Window Builder"); |
| 257 } | 257 } |
| 258 | 258 |
| 259 views::NonClientFrameView* WindowTypeLauncher::CreateNonClientFrameView() { | 259 views::NonClientFrameView* WindowTypeLauncher::CreateNonClientFrameView() { |
| 260 return new aura_shell::internal::ToplevelFrameView; | 260 return new ash::internal::ToplevelFrameView; |
| 261 } | 261 } |
| 262 | 262 |
| 263 void WindowTypeLauncher::ButtonPressed(views::Button* sender, | 263 void WindowTypeLauncher::ButtonPressed(views::Button* sender, |
| 264 const views::Event& event) { | 264 const views::Event& event) { |
| 265 if (sender == create_button_) { | 265 if (sender == create_button_) { |
| 266 ToplevelWindow::CreateParams params; | 266 ToplevelWindow::CreateParams params; |
| 267 params.can_resize = true; | 267 params.can_resize = true; |
| 268 ToplevelWindow::CreateToplevelWindow(params); | 268 ToplevelWindow::CreateToplevelWindow(params); |
| 269 } else if (sender == create_nonresizable_button_) { | 269 } else if (sender == create_nonresizable_button_) { |
| 270 ToplevelWindow::CreateToplevelWindow(ToplevelWindow::CreateParams()); | 270 ToplevelWindow::CreateToplevelWindow(ToplevelWindow::CreateParams()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // MenuRunner takes ownership of root. | 309 // MenuRunner takes ownership of root. |
| 310 menu_runner_.reset(new MenuRunner(root)); | 310 menu_runner_.reset(new MenuRunner(root)); |
| 311 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(p, gfx::Size(0, 0)), | 311 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(p, gfx::Size(0, 0)), |
| 312 MenuItemView::TOPLEFT, | 312 MenuItemView::TOPLEFT, |
| 313 MenuRunner::HAS_MNEMONICS) == MenuRunner::MENU_DELETED) | 313 MenuRunner::HAS_MNEMONICS) == MenuRunner::MENU_DELETED) |
| 314 return; | 314 return; |
| 315 } | 315 } |
| 316 | 316 |
| 317 } // namespace shell | 317 } // namespace shell |
| 318 } // namespace ash | 318 } // namespace ash |
| OLD | NEW |