OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 static void OpenModalWindow(aura::Window* parent, ui::ModalType modal_type) { | 51 static void OpenModalWindow(aura::Window* parent, ui::ModalType modal_type) { |
52 views::Widget* widget = | 52 views::Widget* widget = |
53 views::Widget::CreateWindowWithParent(new ModalWindow(modal_type), | 53 views::Widget::CreateWindowWithParent(new ModalWindow(modal_type), |
54 parent); | 54 parent); |
55 widget->GetNativeView()->SetName("ModalWindow"); | 55 widget->GetNativeView()->SetName("ModalWindow"); |
56 widget->Show(); | 56 widget->Show(); |
57 } | 57 } |
58 | 58 |
59 // Overridden from views::View: | 59 // Overridden from views::View: |
60 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 60 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
61 canvas->FillRect(color_, GetLocalBounds()); | 61 canvas->FillRect(GetLocalBounds(), color_); |
62 } | 62 } |
63 virtual gfx::Size GetPreferredSize() OVERRIDE { | 63 virtual gfx::Size GetPreferredSize() OVERRIDE { |
64 return gfx::Size(200, 200); | 64 return gfx::Size(200, 200); |
65 } | 65 } |
66 virtual void Layout() OVERRIDE { | 66 virtual void Layout() OVERRIDE { |
67 gfx::Size open_ps = open_button_->GetPreferredSize(); | 67 gfx::Size open_ps = open_button_->GetPreferredSize(); |
68 gfx::Rect local_bounds = GetLocalBounds(); | 68 gfx::Rect local_bounds = GetLocalBounds(); |
69 open_button_->SetBounds( | 69 open_button_->SetBounds( |
70 5, local_bounds.bottom() - open_ps.height() - 5, | 70 5, local_bounds.bottom() - open_ps.height() - 5, |
71 open_ps.width(), open_ps.height()); | 71 open_ps.width(), open_ps.height()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 non_modal_transient_->GetNativeView()->SetName("NonModalTransient"); | 123 non_modal_transient_->GetNativeView()->SetName("NonModalTransient"); |
124 } | 124 } |
125 if (non_modal_transient_->IsVisible()) | 125 if (non_modal_transient_->IsVisible()) |
126 non_modal_transient_->Hide(); | 126 non_modal_transient_->Hide(); |
127 else | 127 else |
128 non_modal_transient_->Show(); | 128 non_modal_transient_->Show(); |
129 } | 129 } |
130 | 130 |
131 // Overridden from views::View: | 131 // Overridden from views::View: |
132 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 132 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
133 canvas->FillRect(color_, GetLocalBounds()); | 133 canvas->FillRect(GetLocalBounds(), color_); |
134 } | 134 } |
135 virtual gfx::Size GetPreferredSize() OVERRIDE { | 135 virtual gfx::Size GetPreferredSize() OVERRIDE { |
136 return gfx::Size(250, 250); | 136 return gfx::Size(250, 250); |
137 } | 137 } |
138 | 138 |
139 // Overridden from views::WidgetDelegate: | 139 // Overridden from views::WidgetDelegate: |
140 virtual views::View* GetContentsView() OVERRIDE { | 140 virtual views::View* GetContentsView() OVERRIDE { |
141 return this; | 141 return this; |
142 } | 142 } |
143 virtual bool CanResize() const OVERRIDE { | 143 virtual bool CanResize() const OVERRIDE { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 AddChildView(show_hide_window_button_); | 215 AddChildView(show_hide_window_button_); |
216 #if !defined(OS_MACOSX) | 216 #if !defined(OS_MACOSX) |
217 set_context_menu_controller(this); | 217 set_context_menu_controller(this); |
218 #endif | 218 #endif |
219 } | 219 } |
220 | 220 |
221 WindowTypeLauncher::~WindowTypeLauncher() { | 221 WindowTypeLauncher::~WindowTypeLauncher() { |
222 } | 222 } |
223 | 223 |
224 void WindowTypeLauncher::OnPaint(gfx::Canvas* canvas) { | 224 void WindowTypeLauncher::OnPaint(gfx::Canvas* canvas) { |
225 canvas->FillRect(SK_ColorWHITE, GetLocalBounds()); | 225 canvas->FillRect(GetLocalBounds(), SK_ColorWHITE); |
226 } | 226 } |
227 | 227 |
228 void WindowTypeLauncher::Layout() { | 228 void WindowTypeLauncher::Layout() { |
229 gfx::Size create_button_ps = create_button_->GetPreferredSize(); | 229 gfx::Size create_button_ps = create_button_->GetPreferredSize(); |
230 gfx::Rect local_bounds = GetLocalBounds(); | 230 gfx::Rect local_bounds = GetLocalBounds(); |
231 create_button_->SetBounds( | 231 create_button_->SetBounds( |
232 5, local_bounds.bottom() - create_button_ps.height() - 5, | 232 5, local_bounds.bottom() - create_button_ps.height() - 5, |
233 create_button_ps.width(), create_button_ps.height()); | 233 create_button_ps.width(), create_button_ps.height()); |
234 | 234 |
235 gfx::Size bubble_button_ps = bubble_button_->GetPreferredSize(); | 235 gfx::Size bubble_button_ps = bubble_button_->GetPreferredSize(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 menu_runner_.reset(new MenuRunner(root)); | 363 menu_runner_.reset(new MenuRunner(root)); |
364 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(p, gfx::Size(0, 0)), | 364 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(p, gfx::Size(0, 0)), |
365 MenuItemView::TOPLEFT, | 365 MenuItemView::TOPLEFT, |
366 MenuRunner::HAS_MNEMONICS) == MenuRunner::MENU_DELETED) | 366 MenuRunner::HAS_MNEMONICS) == MenuRunner::MENU_DELETED) |
367 return; | 367 return; |
368 } | 368 } |
369 #endif // !defined(OS_MACOSX) | 369 #endif // !defined(OS_MACOSX) |
370 | 370 |
371 } // namespace shell | 371 } // namespace shell |
372 } // namespace ash | 372 } // namespace ash |
OLD | NEW |