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 |
166 const char AppNonClientFrameViewAura::kControlWindowName[] = | 169 const char AppNonClientFrameViewAura::kControlWindowName[] = |
167 "AppNonClientFrameViewAuraControls"; | 170 "AppNonClientFrameViewAuraControls"; |
168 | 171 |
169 AppNonClientFrameViewAura::AppNonClientFrameViewAura( | 172 AppNonClientFrameViewAura::AppNonClientFrameViewAura( |
170 BrowserFrame* frame, BrowserView* browser_view) | 173 BrowserFrame* frame, BrowserView* browser_view) |
171 : BrowserNonClientFrameView(frame, browser_view), | 174 : BrowserNonClientFrameView(frame, browser_view), |
172 control_view_(new ControlView(this)), | 175 control_view_(new ControlView(this)), |
173 control_widget_(NULL), | 176 control_widget_(NULL), |
174 frame_observer_(new FrameObserver(this)) { | 177 frame_observer_(new FrameObserver(this)) { |
175 // This FrameView is always maximized so we don't want the window to have | 178 // 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... |
236 return TabStripInsets(); | 239 return TabStripInsets(); |
237 } | 240 } |
238 | 241 |
239 int AppNonClientFrameViewAura::GetThemeBackgroundXInset() const { | 242 int AppNonClientFrameViewAura::GetThemeBackgroundXInset() const { |
240 return 0; | 243 return 0; |
241 } | 244 } |
242 | 245 |
243 void AppNonClientFrameViewAura::UpdateThrobber(bool running) { | 246 void AppNonClientFrameViewAura::UpdateThrobber(bool running) { |
244 } | 247 } |
245 | 248 |
| 249 std::string AppNonClientFrameViewAura::GetClassName() const { |
| 250 return kViewClassName; |
| 251 } |
| 252 |
246 void AppNonClientFrameViewAura::OnBoundsChanged( | 253 void AppNonClientFrameViewAura::OnBoundsChanged( |
247 const gfx::Rect& previous_bounds) { | 254 const gfx::Rect& previous_bounds) { |
248 if (control_widget_) | 255 if (control_widget_) |
249 control_widget_->GetNativeView()->SetBounds(GetControlBounds()); | 256 control_widget_->GetNativeView()->SetBounds(GetControlBounds()); |
250 } | 257 } |
251 | 258 |
252 gfx::Rect AppNonClientFrameViewAura::GetControlBounds() const { | 259 gfx::Rect AppNonClientFrameViewAura::GetControlBounds() const { |
253 if (!control_view_) | 260 if (!control_view_) |
254 return gfx::Rect(); | 261 return gfx::Rect(); |
255 gfx::Size preferred = control_view_->GetPreferredSize(); | 262 gfx::Size preferred = control_view_->GetPreferredSize(); |
256 return gfx::Rect( | 263 return gfx::Rect( |
257 width() - preferred.width(), 0, | 264 width() - preferred.width(), 0, |
258 preferred.width(), preferred.height()); | 265 preferred.width(), preferred.height()); |
259 } | 266 } |
260 | 267 |
261 void AppNonClientFrameViewAura::CloseControlWidget() { | 268 void AppNonClientFrameViewAura::CloseControlWidget() { |
262 if (control_widget_) { | 269 if (control_widget_) { |
263 control_widget_->Close(); | 270 control_widget_->Close(); |
264 control_widget_ = NULL; | 271 control_widget_ = NULL; |
265 } | 272 } |
266 } | 273 } |
OLD | NEW |