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

Side by Side Diff: ui/views/widget/native_widget_aura.cc

Issue 8771015: Rename Desktop->RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | « ui/views/widget/native_widget_aura.h ('k') | ui/views/widget/tooltip_manager_aura.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 "ui/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/drag_drop_client.h" 10 #include "ui/aura/client/drag_drop_client.h"
11 #include "ui/aura/client/shadow_types.h" 11 #include "ui/aura/client/shadow_types.h"
12 #include "ui/aura/desktop.h"
13 #include "ui/aura/desktop_observer.h"
14 #include "ui/aura/event.h" 12 #include "ui/aura/event.h"
13 #include "ui/aura/root_window.h"
14 #include "ui/aura/root_window_observer.h"
15 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
16 #include "ui/aura/window_types.h" 16 #include "ui/aura/window_types.h"
17 #include "ui/base/dragdrop/os_exchange_data.h" 17 #include "ui/base/dragdrop/os_exchange_data.h"
18 #include "ui/base/ui_base_types.h" 18 #include "ui/base/ui_base_types.h"
19 #include "ui/gfx/canvas.h" 19 #include "ui/gfx/canvas.h"
20 #include "ui/gfx/compositor/layer.h" 20 #include "ui/gfx/compositor/layer.h"
21 #include "ui/gfx/font.h" 21 #include "ui/gfx/font.h"
22 #include "ui/gfx/screen.h" 22 #include "ui/gfx/screen.h"
23 #include "ui/views/widget/drop_helper.h" 23 #include "ui/views/widget/drop_helper.h"
24 #include "ui/views/widget/native_widget_delegate.h" 24 #include "ui/views/widget/native_widget_delegate.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 default: 57 default:
58 NOTREACHED() << "Unhandled widget type " << type; 58 NOTREACHED() << "Unhandled widget type " << type;
59 return aura::WINDOW_TYPE_UNKNOWN; 59 return aura::WINDOW_TYPE_UNKNOWN;
60 } 60 }
61 } 61 }
62 62
63 } // namespace 63 } // namespace
64 64
65 // Used when SetInactiveRenderingDisabled() is invoked to track when active 65 // Used when SetInactiveRenderingDisabled() is invoked to track when active
66 // status changes in such a way that we should enable inactive rendering. 66 // status changes in such a way that we should enable inactive rendering.
67 class NativeWidgetAura::DesktopObserverImpl : public aura::DesktopObserver { 67 class NativeWidgetAura::RootWindowObserverImpl
68 : public aura::RootWindowObserver {
68 public: 69 public:
69 explicit DesktopObserverImpl(NativeWidgetAura* host) 70 explicit RootWindowObserverImpl(NativeWidgetAura* host)
70 : host_(host) { 71 : host_(host) {
71 aura::Desktop::GetInstance()->AddObserver(this); 72 aura::RootWindow::GetInstance()->AddObserver(this);
72 } 73 }
73 74
74 virtual ~DesktopObserverImpl() { 75 virtual ~RootWindowObserverImpl() {
75 aura::Desktop::GetInstance()->RemoveObserver(this); 76 aura::RootWindow::GetInstance()->RemoveObserver(this);
76 } 77 }
77 78
78 // DesktopObserver overrides: 79 // RootWindowObserver overrides:
79 virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE { 80 virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE {
80 if (!active || (active != host_->window_ && 81 if (!active || (active != host_->window_ &&
81 active->transient_parent() != host_->window_)) { 82 active->transient_parent() != host_->window_)) {
82 host_->delegate_->EnableInactiveRendering(); 83 host_->delegate_->EnableInactiveRendering();
83 } 84 }
84 } 85 }
85 86
86 private: 87 private:
87 NativeWidgetAura* host_; 88 NativeWidgetAura* host_;
88 89
89 DISALLOW_COPY_AND_ASSIGN(DesktopObserverImpl); 90 DISALLOW_COPY_AND_ASSIGN(RootWindowObserverImpl);
90 }; 91 };
91 92
92 //////////////////////////////////////////////////////////////////////////////// 93 ////////////////////////////////////////////////////////////////////////////////
93 // NativeWidgetAura, public: 94 // NativeWidgetAura, public:
94 95
95 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate) 96 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate)
96 : delegate_(delegate), 97 : delegate_(delegate),
97 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), 98 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))),
98 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), 99 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
99 ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)), 100 ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)),
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 422
422 void NativeWidgetAura::Activate() { 423 void NativeWidgetAura::Activate() {
423 window_->Activate(); 424 window_->Activate();
424 } 425 }
425 426
426 void NativeWidgetAura::Deactivate() { 427 void NativeWidgetAura::Deactivate() {
427 window_->Deactivate(); 428 window_->Deactivate();
428 } 429 }
429 430
430 bool NativeWidgetAura::IsActive() const { 431 bool NativeWidgetAura::IsActive() const {
431 return aura::Desktop::GetInstance()->active_window() == window_; 432 return aura::RootWindow::GetInstance()->active_window() == window_;
432 } 433 }
433 434
434 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { 435 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) {
435 window_->SetIntProperty(aura::kAlwaysOnTopKey, on_top); 436 window_->SetIntProperty(aura::kAlwaysOnTopKey, on_top);
436 } 437 }
437 438
438 void NativeWidgetAura::Maximize() { 439 void NativeWidgetAura::Maximize() {
439 window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 440 window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
440 } 441 }
441 442
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 bool NativeWidgetAura::IsAccessibleWidget() const { 481 bool NativeWidgetAura::IsAccessibleWidget() const {
481 // http://crbug.com/102570 482 // http://crbug.com/102570
482 //NOTIMPLEMENTED(); 483 //NOTIMPLEMENTED();
483 return false; 484 return false;
484 } 485 }
485 486
486 void NativeWidgetAura::RunShellDrag(View* view, 487 void NativeWidgetAura::RunShellDrag(View* view,
487 const ui::OSExchangeData& data, 488 const ui::OSExchangeData& data,
488 int operation) { 489 int operation) {
489 aura::DragDropClient* client = static_cast<aura::DragDropClient*>( 490 aura::DragDropClient* client = static_cast<aura::DragDropClient*>(
490 aura::Desktop::GetInstance()->GetProperty( 491 aura::RootWindow::GetInstance()->GetProperty(
491 aura::kDesktopDragDropClientKey)); 492 aura::kRootWindowDragDropClientKey));
492 if (client) 493 if (client)
493 client->StartDragAndDrop(data, operation); 494 client->StartDragAndDrop(data, operation);
494 } 495 }
495 496
496 void NativeWidgetAura::SchedulePaintInRect(const gfx::Rect& rect) { 497 void NativeWidgetAura::SchedulePaintInRect(const gfx::Rect& rect) {
497 if (window_) 498 if (window_)
498 window_->SchedulePaintInRect(rect); 499 window_->SchedulePaintInRect(rect);
499 } 500 }
500 501
501 void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { 502 void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) {
502 cursor_ = cursor; 503 cursor_ = cursor;
503 aura::Desktop::GetInstance()->SetCursor(cursor); 504 aura::RootWindow::GetInstance()->SetCursor(cursor);
504 } 505 }
505 506
506 void NativeWidgetAura::ClearNativeFocus() { 507 void NativeWidgetAura::ClearNativeFocus() {
507 if (window_ && window_->GetFocusManager()) 508 if (window_ && window_->GetFocusManager())
508 window_->GetFocusManager()->SetFocusedWindow(window_); 509 window_->GetFocusManager()->SetFocusedWindow(window_);
509 } 510 }
510 511
511 void NativeWidgetAura::FocusNativeView(gfx::NativeView native_view) { 512 void NativeWidgetAura::FocusNativeView(gfx::NativeView native_view) {
512 window_->GetFocusManager()->SetFocusedWindow(native_view); 513 window_->GetFocusManager()->SetFocusedWindow(native_view);
513 } 514 }
514 515
515 gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { 516 gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const {
516 return gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); 517 return gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView());
517 } 518 }
518 519
519 void NativeWidgetAura::SetInactiveRenderingDisabled(bool value) { 520 void NativeWidgetAura::SetInactiveRenderingDisabled(bool value) {
520 if (!value) 521 if (!value)
521 desktop_observer_.reset(); 522 root_window_observer_.reset();
522 else 523 else
523 desktop_observer_.reset(new DesktopObserverImpl(this)); 524 root_window_observer_.reset(new RootWindowObserverImpl(this));
524 } 525 }
525 526
526 //////////////////////////////////////////////////////////////////////////////// 527 ////////////////////////////////////////////////////////////////////////////////
527 // NativeWidgetAura, views::InputMethodDelegate implementation: 528 // NativeWidgetAura, views::InputMethodDelegate implementation:
528 529
529 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { 530 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) {
530 if (delegate_->OnKeyEvent(key)) 531 if (delegate_->OnKeyEvent(key))
531 return; 532 return;
532 if (key.type() == ui::ET_KEY_PRESSED && GetWidget()->GetFocusManager()) 533 if (key.type() == ui::ET_KEY_PRESSED && GetWidget()->GetFocusManager())
533 GetWidget()->GetFocusManager()->OnKeyEvent(key); 534 GetWidget()->GetFocusManager()->OnKeyEvent(key);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 785
785 // And now, notify them that they have a brand new parent. 786 // And now, notify them that they have a brand new parent.
786 for (Widget::Widgets::iterator it = widgets.begin(); 787 for (Widget::Widgets::iterator it = widgets.begin();
787 it != widgets.end(); ++it) { 788 it != widgets.end(); ++it) {
788 (*it)->NotifyNativeViewHierarchyChanged(true, new_parent); 789 (*it)->NotifyNativeViewHierarchyChanged(true, new_parent);
789 } 790 }
790 } 791 }
791 792
792 // static 793 // static
793 bool NativeWidgetPrivate::IsMouseButtonDown() { 794 bool NativeWidgetPrivate::IsMouseButtonDown() {
794 return aura::Desktop::GetInstance()->IsMouseButtonDown(); 795 return aura::RootWindow::GetInstance()->IsMouseButtonDown();
795 } 796 }
796 797
797 } // namespace internal 798 } // namespace internal
798 } // namespace views 799 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/views/widget/tooltip_manager_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698