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/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/screensaver/screensaver_view.h" | 8 #include "ash/screensaver/screensaver_view.h" |
9 #include "ash/session/session_state_delegate.h" | 9 #include "ash/session/session_state_delegate.h" |
10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 static void OpenModalWindow(aura::Window* parent, ui::ModalType modal_type) { | 67 static void OpenModalWindow(aura::Window* parent, ui::ModalType modal_type) { |
68 views::Widget* widget = | 68 views::Widget* widget = |
69 views::Widget::CreateWindowWithParent(new ModalWindow(modal_type), | 69 views::Widget::CreateWindowWithParent(new ModalWindow(modal_type), |
70 parent); | 70 parent); |
71 widget->GetNativeView()->SetName("ModalWindow"); | 71 widget->GetNativeView()->SetName("ModalWindow"); |
72 widget->Show(); | 72 widget->Show(); |
73 } | 73 } |
74 | 74 |
75 // Overridden from views::View: | 75 // Overridden from views::View: |
76 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 76 virtual void OnPaint(gfx::Canvas* canvas) override { |
77 canvas->FillRect(GetLocalBounds(), color_); | 77 canvas->FillRect(GetLocalBounds(), color_); |
78 } | 78 } |
79 virtual gfx::Size GetPreferredSize() const OVERRIDE { | 79 virtual gfx::Size GetPreferredSize() const override { |
80 return gfx::Size(200, 200); | 80 return gfx::Size(200, 200); |
81 } | 81 } |
82 virtual void Layout() OVERRIDE { | 82 virtual void Layout() override { |
83 gfx::Size open_ps = open_button_->GetPreferredSize(); | 83 gfx::Size open_ps = open_button_->GetPreferredSize(); |
84 gfx::Rect local_bounds = GetLocalBounds(); | 84 gfx::Rect local_bounds = GetLocalBounds(); |
85 open_button_->SetBounds( | 85 open_button_->SetBounds( |
86 5, local_bounds.bottom() - open_ps.height() - 5, | 86 5, local_bounds.bottom() - open_ps.height() - 5, |
87 open_ps.width(), open_ps.height()); | 87 open_ps.width(), open_ps.height()); |
88 } | 88 } |
89 | 89 |
90 // Overridden from views::WidgetDelegate: | 90 // Overridden from views::WidgetDelegate: |
91 virtual views::View* GetContentsView() OVERRIDE { | 91 virtual views::View* GetContentsView() override { |
92 return this; | 92 return this; |
93 } | 93 } |
94 virtual bool CanResize() const OVERRIDE { | 94 virtual bool CanResize() const override { |
95 return true; | 95 return true; |
96 } | 96 } |
97 virtual base::string16 GetWindowTitle() const OVERRIDE { | 97 virtual base::string16 GetWindowTitle() const override { |
98 return base::ASCIIToUTF16("Modal Window"); | 98 return base::ASCIIToUTF16("Modal Window"); |
99 } | 99 } |
100 virtual ui::ModalType GetModalType() const OVERRIDE { | 100 virtual ui::ModalType GetModalType() const override { |
101 return modal_type_; | 101 return modal_type_; |
102 } | 102 } |
103 | 103 |
104 // Overridden from views::ButtonListener: | 104 // Overridden from views::ButtonListener: |
105 virtual void ButtonPressed(views::Button* sender, | 105 virtual void ButtonPressed(views::Button* sender, |
106 const ui::Event& event) OVERRIDE { | 106 const ui::Event& event) override { |
107 DCHECK(sender == open_button_); | 107 DCHECK(sender == open_button_); |
108 OpenModalWindow(GetWidget()->GetNativeView(), modal_type_); | 108 OpenModalWindow(GetWidget()->GetNativeView(), modal_type_); |
109 } | 109 } |
110 | 110 |
111 private: | 111 private: |
112 ui::ModalType modal_type_; | 112 ui::ModalType modal_type_; |
113 SkColor color_; | 113 SkColor color_; |
114 views::LabelButton* open_button_; | 114 views::LabelButton* open_button_; |
115 | 115 |
116 DISALLOW_COPY_AND_ASSIGN(ModalWindow); | 116 DISALLOW_COPY_AND_ASSIGN(ModalWindow); |
(...skipping 21 matching lines...) Expand all Loading... |
138 views::Widget::CreateWindowWithParent(new NonModalTransient, parent); | 138 views::Widget::CreateWindowWithParent(new NonModalTransient, parent); |
139 non_modal_transient_->GetNativeView()->SetName("NonModalTransient"); | 139 non_modal_transient_->GetNativeView()->SetName("NonModalTransient"); |
140 } | 140 } |
141 if (non_modal_transient_->IsVisible()) | 141 if (non_modal_transient_->IsVisible()) |
142 non_modal_transient_->Hide(); | 142 non_modal_transient_->Hide(); |
143 else | 143 else |
144 non_modal_transient_->Show(); | 144 non_modal_transient_->Show(); |
145 } | 145 } |
146 | 146 |
147 // Overridden from views::View: | 147 // Overridden from views::View: |
148 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 148 virtual void OnPaint(gfx::Canvas* canvas) override { |
149 canvas->FillRect(GetLocalBounds(), color_); | 149 canvas->FillRect(GetLocalBounds(), color_); |
150 } | 150 } |
151 virtual gfx::Size GetPreferredSize() const OVERRIDE { | 151 virtual gfx::Size GetPreferredSize() const override { |
152 return gfx::Size(250, 250); | 152 return gfx::Size(250, 250); |
153 } | 153 } |
154 | 154 |
155 // Overridden from views::WidgetDelegate: | 155 // Overridden from views::WidgetDelegate: |
156 virtual views::View* GetContentsView() OVERRIDE { | 156 virtual views::View* GetContentsView() override { |
157 return this; | 157 return this; |
158 } | 158 } |
159 virtual bool CanResize() const OVERRIDE { | 159 virtual bool CanResize() const override { |
160 return true; | 160 return true; |
161 } | 161 } |
162 virtual base::string16 GetWindowTitle() const OVERRIDE { | 162 virtual base::string16 GetWindowTitle() const override { |
163 return base::ASCIIToUTF16("Non-Modal Transient"); | 163 return base::ASCIIToUTF16("Non-Modal Transient"); |
164 } | 164 } |
165 virtual void DeleteDelegate() OVERRIDE { | 165 virtual void DeleteDelegate() override { |
166 if (GetWidget() == non_modal_transient_) | 166 if (GetWidget() == non_modal_transient_) |
167 non_modal_transient_ = NULL; | 167 non_modal_transient_ = NULL; |
168 | 168 |
169 delete this; | 169 delete this; |
170 } | 170 } |
171 | 171 |
172 private: | 172 private: |
173 SkColor color_; | 173 SkColor color_; |
174 | 174 |
175 static views::Widget* non_modal_transient_; | 175 static views::Widget* non_modal_transient_; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 NULL, | 396 NULL, |
397 gfx::Rect(point, gfx::Size()), | 397 gfx::Rect(point, gfx::Size()), |
398 views::MENU_ANCHOR_TOPLEFT, | 398 views::MENU_ANCHOR_TOPLEFT, |
399 source_type) == MenuRunner::MENU_DELETED) { | 399 source_type) == MenuRunner::MENU_DELETED) { |
400 return; | 400 return; |
401 } | 401 } |
402 } | 402 } |
403 | 403 |
404 } // namespace shell | 404 } // namespace shell |
405 } // namespace ash | 405 } // namespace ash |
OLD | NEW |