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 "chrome/browser/ui/views/frame/app_non_client_frame_view_aura.h" | 5 #include "chrome/browser/ui/views/frame/app_non_client_frame_view_aura.h" |
6 | 6 |
7 #include "base/debug/stack_trace.h" | 7 #include "base/debug/stack_trace.h" |
8 #include "chrome/browser/ui/views/frame/browser_frame.h" | 8 #include "chrome/browser/ui/views/frame/browser_frame.h" |
9 #include "chrome/browser/ui/views/frame/browser_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_view.h" |
10 #include "grit/ash_resources.h" | 10 #include "grit/ash_resources.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 owner_->CloseControlWidget(); | 156 owner_->CloseControlWidget(); |
157 } | 157 } |
158 | 158 |
159 private: | 159 private: |
160 AppNonClientFrameViewAura* owner_; | 160 AppNonClientFrameViewAura* owner_; |
161 | 161 |
162 DISALLOW_COPY_AND_ASSIGN(FrameObserver); | 162 DISALLOW_COPY_AND_ASSIGN(FrameObserver); |
163 }; | 163 }; |
164 | 164 |
165 // static | 165 // static |
166 const char AppNonClientFrameViewAura::kViewClassName[] = | |
167 "AppNonClientFrameViewAura"; | |
168 // static | |
169 const char AppNonClientFrameViewAura::kControlWindowName[] = | 166 const char AppNonClientFrameViewAura::kControlWindowName[] = |
170 "AppNonClientFrameViewAuraControls"; | 167 "AppNonClientFrameViewAuraControls"; |
171 | 168 |
172 AppNonClientFrameViewAura::AppNonClientFrameViewAura( | 169 AppNonClientFrameViewAura::AppNonClientFrameViewAura( |
173 BrowserFrame* frame, BrowserView* browser_view) | 170 BrowserFrame* frame, BrowserView* browser_view) |
174 : BrowserNonClientFrameView(frame, browser_view), | 171 : BrowserNonClientFrameView(frame, browser_view), |
175 control_view_(new ControlView(this)), | 172 control_view_(new ControlView(this)), |
176 control_widget_(NULL), | 173 control_widget_(NULL), |
177 frame_observer_(new FrameObserver(this)) { | 174 frame_observer_(new FrameObserver(this)) { |
178 // This FrameView is always maximized so we don't want the window to have | 175 // This FrameView is always maximized so we don't want the window to have |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 return TabStripInsets(); | 236 return TabStripInsets(); |
240 } | 237 } |
241 | 238 |
242 int AppNonClientFrameViewAura::GetThemeBackgroundXInset() const { | 239 int AppNonClientFrameViewAura::GetThemeBackgroundXInset() const { |
243 return 0; | 240 return 0; |
244 } | 241 } |
245 | 242 |
246 void AppNonClientFrameViewAura::UpdateThrobber(bool running) { | 243 void AppNonClientFrameViewAura::UpdateThrobber(bool running) { |
247 } | 244 } |
248 | 245 |
249 std::string AppNonClientFrameViewAura::GetClassName() const { | |
250 return kViewClassName; | |
251 } | |
252 | |
253 void AppNonClientFrameViewAura::OnBoundsChanged( | 246 void AppNonClientFrameViewAura::OnBoundsChanged( |
254 const gfx::Rect& previous_bounds) { | 247 const gfx::Rect& previous_bounds) { |
255 if (control_widget_) | 248 if (control_widget_) |
256 control_widget_->GetNativeView()->SetBounds(GetControlBounds()); | 249 control_widget_->GetNativeView()->SetBounds(GetControlBounds()); |
257 } | 250 } |
258 | 251 |
259 gfx::Rect AppNonClientFrameViewAura::GetControlBounds() const { | 252 gfx::Rect AppNonClientFrameViewAura::GetControlBounds() const { |
260 if (!control_view_) | 253 if (!control_view_) |
261 return gfx::Rect(); | 254 return gfx::Rect(); |
262 gfx::Size preferred = control_view_->GetPreferredSize(); | 255 gfx::Size preferred = control_view_->GetPreferredSize(); |
263 return gfx::Rect( | 256 return gfx::Rect( |
264 width() - preferred.width(), 0, | 257 width() - preferred.width(), 0, |
265 preferred.width(), preferred.height()); | 258 preferred.width(), preferred.height()); |
266 } | 259 } |
267 | 260 |
268 void AppNonClientFrameViewAura::CloseControlWidget() { | 261 void AppNonClientFrameViewAura::CloseControlWidget() { |
269 if (control_widget_) { | 262 if (control_widget_) { |
270 control_widget_->Close(); | 263 control_widget_->Close(); |
271 control_widget_ = NULL; | 264 control_widget_ = NULL; |
272 } | 265 } |
273 } | 266 } |
OLD | NEW |