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

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

Issue 6975037: Revert 85666 - 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) {
42 } 41 }
43 42
44 Window::~Window() { 43 Window::~Window() {
45 } 44 }
46 45
47 // static 46 // static
48 Window* Window::CreateChromeWindow(gfx::NativeWindow parent, 47 Window* Window::CreateChromeWindow(gfx::NativeWindow parent,
49 const gfx::Rect& bounds, 48 const gfx::Rect& bounds,
50 WindowDelegate* window_delegate) { 49 WindowDelegate* window_delegate) {
51 Window* window = new Window; 50 Window* window = new Window;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 231
233 void Window::UpdateFrameAfterFrameChange() { 232 void Window::UpdateFrameAfterFrameChange() {
234 native_window_->UpdateFrameAfterFrameChange(); 233 native_window_->UpdateFrameAfterFrameChange();
235 } 234 }
236 235
237 gfx::NativeWindow Window::GetNativeWindow() const { 236 gfx::NativeWindow Window::GetNativeWindow() const {
238 return native_window_->GetNativeWindow(); 237 return native_window_->GetNativeWindow();
239 } 238 }
240 239
241 bool Window::ShouldUseNativeFrame() const { 240 bool Window::ShouldUseNativeFrame() const {
242 if (frame_type_ != FRAME_TYPE_DEFAULT)
243 return frame_type_ == FRAME_TYPE_FORCE_NATIVE;
244 return native_window_->ShouldUseNativeFrame(); 241 return native_window_->ShouldUseNativeFrame();
245 } 242 }
246 243
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
258 void Window::FrameTypeChanged() { 244 void Window::FrameTypeChanged() {
259 native_window_->FrameTypeChanged(); 245 native_window_->FrameTypeChanged();
260 } 246 }
261 247
262 //////////////////////////////////////////////////////////////////////////////// 248 ////////////////////////////////////////////////////////////////////////////////
263 // Window, internal::NativeWindowDelegate implementation: 249 // Window, internal::NativeWindowDelegate implementation:
264 250
265 bool Window::CanActivate() const { 251 bool Window::CanActivate() const {
266 return window_delegate_->CanActivate(); 252 return window_delegate_->CanActivate();
267 } 253 }
268 254
269 bool Window::IsInactiveRenderingDisabled() const { 255 bool Window::IsInactiveRenderingDisabled() const {
270 return disable_inactive_rendering_; 256 return disable_inactive_rendering_;
271 } 257 }
272 258
273 void Window::EnableInactiveRendering() { 259 void Window::EnableInactiveRendering() {
274 disable_inactive_rendering_ = false; 260 disable_inactive_rendering_ = false;
275 non_client_view_->DisableInactiveRendering(false); 261 non_client_view_->DisableInactiveRendering(false);
276 } 262 }
277 263
278 bool Window::IsModal() const { 264 bool Window::IsModal() const {
279 return window_delegate_->IsModal(); 265 return window_delegate_->IsModal();
280 } 266 }
281 267
282 bool Window::IsDialogBox() const { 268 bool Window::IsDialogBox() const {
283 return !!window_delegate_->AsDialogDelegate(); 269 return !!window_delegate_->AsDialogDelegate();
284 } 270 }
285 271
272 bool Window::IsUsingNativeFrame() const {
273 return non_client_view_->UseNativeFrame();
274 }
275
286 gfx::Size Window::GetMinimumSize() const { 276 gfx::Size Window::GetMinimumSize() const {
287 return non_client_view_->GetMinimumSize(); 277 return non_client_view_->GetMinimumSize();
288 } 278 }
289 279
290 int Window::GetNonClientComponent(const gfx::Point& point) const { 280 int Window::GetNonClientComponent(const gfx::Point& point) const {
291 return non_client_view_->NonClientHitTest(point); 281 return non_client_view_->NonClientHitTest(point);
292 } 282 }
293 283
294 bool Window::ExecuteCommand(int command_id) { 284 bool Window::ExecuteCommand(int command_id) {
295 return window_delegate_->ExecuteWindowsCommand(command_id); 285 return window_delegate_->ExecuteWindowsCommand(command_id);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 if (!window_delegate_) 400 if (!window_delegate_)
411 return; 401 return;
412 402
413 bool maximized; 403 bool maximized;
414 gfx::Rect bounds; 404 gfx::Rect bounds;
415 native_window_->GetWindowBoundsAndMaximizedState(&bounds, &maximized); 405 native_window_->GetWindowBoundsAndMaximizedState(&bounds, &maximized);
416 window_delegate_->SaveWindowPlacement(bounds, maximized); 406 window_delegate_->SaveWindowPlacement(bounds, maximized);
417 } 407 }
418 408
419 } // namespace views 409 } // 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