Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(915)

Side by Side Diff: views/window/window.cc

Issue 7036014: Consolidate ShouldUseNativeFrame/AlwaysUseNativeFrame/UseNativeFrame spaghetti. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/window/window.h ('k') | views/window/window_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "views/window/window.h" 5 #include "views/window/window.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "ui/base/l10n/l10n_font_util.h" 10 #include "ui/base/l10n/l10n_font_util.h"
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 Window::Window() 32 Window::Window()
33 : native_window_(NULL), 33 : native_window_(NULL),
34 window_delegate_(NULL), 34 window_delegate_(NULL),
35 ALLOW_THIS_IN_INITIALIZER_LIST( 35 ALLOW_THIS_IN_INITIALIZER_LIST(
36 non_client_view_(new NonClientView(this))), 36 non_client_view_(new NonClientView(this))),
37 saved_maximized_state_(false), 37 saved_maximized_state_(false),
38 minimum_size_(100, 100), 38 minimum_size_(100, 100),
39 disable_inactive_rendering_(false), 39 disable_inactive_rendering_(false),
40 window_closed_(false) { 40 window_closed_(false),
41 frame_type_(FRAME_TYPE_DEFAULT) {
41 } 42 }
42 43
43 Window::~Window() { 44 Window::~Window() {
44 } 45 }
45 46
46 // static 47 // static
47 Window* Window::CreateChromeWindow(gfx::NativeWindow parent, 48 Window* Window::CreateChromeWindow(gfx::NativeWindow parent,
48 const gfx::Rect& bounds, 49 const gfx::Rect& bounds,
49 WindowDelegate* window_delegate) { 50 WindowDelegate* window_delegate) {
50 Window* window = new Window; 51 Window* window = new Window;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 232
232 void Window::UpdateFrameAfterFrameChange() { 233 void Window::UpdateFrameAfterFrameChange() {
233 native_window_->UpdateFrameAfterFrameChange(); 234 native_window_->UpdateFrameAfterFrameChange();
234 } 235 }
235 236
236 gfx::NativeWindow Window::GetNativeWindow() const { 237 gfx::NativeWindow Window::GetNativeWindow() const {
237 return native_window_->GetNativeWindow(); 238 return native_window_->GetNativeWindow();
238 } 239 }
239 240
240 bool Window::ShouldUseNativeFrame() const { 241 bool Window::ShouldUseNativeFrame() const {
242 if (frame_type_ != FRAME_TYPE_DEFAULT)
243 return frame_type_ == FRAME_TYPE_FORCE_NATIVE;
241 return native_window_->ShouldUseNativeFrame(); 244 return native_window_->ShouldUseNativeFrame();
242 } 245 }
243 246
247 void Window::DebugToggleFrameType() {
248 if (frame_type_ == FRAME_TYPE_DEFAULT) {
249 frame_type_ = ShouldUseNativeFrame() ? FRAME_TYPE_FORCE_CUSTOM :
250 FRAME_TYPE_FORCE_NATIVE;
251 } else {
252 frame_type_ = frame_type_ == FRAME_TYPE_FORCE_CUSTOM ?
253 FRAME_TYPE_FORCE_NATIVE : FRAME_TYPE_FORCE_CUSTOM;
254 }
255 FrameTypeChanged();
256 }
257
244 void Window::FrameTypeChanged() { 258 void Window::FrameTypeChanged() {
245 native_window_->FrameTypeChanged(); 259 native_window_->FrameTypeChanged();
246 } 260 }
247 261
248 //////////////////////////////////////////////////////////////////////////////// 262 ////////////////////////////////////////////////////////////////////////////////
249 // Window, internal::NativeWindowDelegate implementation: 263 // Window, internal::NativeWindowDelegate implementation:
250 264
251 bool Window::CanActivate() const { 265 bool Window::CanActivate() const {
252 return window_delegate_->CanActivate(); 266 return window_delegate_->CanActivate();
253 } 267 }
254 268
255 bool Window::IsInactiveRenderingDisabled() const { 269 bool Window::IsInactiveRenderingDisabled() const {
256 return disable_inactive_rendering_; 270 return disable_inactive_rendering_;
257 } 271 }
258 272
259 void Window::EnableInactiveRendering() { 273 void Window::EnableInactiveRendering() {
260 disable_inactive_rendering_ = false; 274 disable_inactive_rendering_ = false;
261 non_client_view_->DisableInactiveRendering(false); 275 non_client_view_->DisableInactiveRendering(false);
262 } 276 }
263 277
264 bool Window::IsModal() const { 278 bool Window::IsModal() const {
265 return window_delegate_->IsModal(); 279 return window_delegate_->IsModal();
266 } 280 }
267 281
268 bool Window::IsDialogBox() const { 282 bool Window::IsDialogBox() const {
269 return !!window_delegate_->AsDialogDelegate(); 283 return !!window_delegate_->AsDialogDelegate();
270 } 284 }
271 285
272 bool Window::IsUsingNativeFrame() const {
273 return non_client_view_->UseNativeFrame();
274 }
275
276 gfx::Size Window::GetMinimumSize() const { 286 gfx::Size Window::GetMinimumSize() const {
277 return non_client_view_->GetMinimumSize(); 287 return non_client_view_->GetMinimumSize();
278 } 288 }
279 289
280 int Window::GetNonClientComponent(const gfx::Point& point) const { 290 int Window::GetNonClientComponent(const gfx::Point& point) const {
281 return non_client_view_->NonClientHitTest(point); 291 return non_client_view_->NonClientHitTest(point);
282 } 292 }
283 293
284 bool Window::ExecuteCommand(int command_id) { 294 bool Window::ExecuteCommand(int command_id) {
285 return window_delegate_->ExecuteWindowsCommand(command_id); 295 return window_delegate_->ExecuteWindowsCommand(command_id);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if (!window_delegate_) 410 if (!window_delegate_)
401 return; 411 return;
402 412
403 bool maximized; 413 bool maximized;
404 gfx::Rect bounds; 414 gfx::Rect bounds;
405 native_window_->GetWindowBoundsAndMaximizedState(&bounds, &maximized); 415 native_window_->GetWindowBoundsAndMaximizedState(&bounds, &maximized);
406 window_delegate_->SaveWindowPlacement(bounds, maximized); 416 window_delegate_->SaveWindowPlacement(bounds, maximized);
407 } 417 }
408 418
409 } // namespace views 419 } // namespace views
OLDNEW
« no previous file with comments | « views/window/window.h ('k') | views/window/window_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698