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

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

Issue 2479353003: Revert of Window prerequisites for ShelfWindowWatcher panel support. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.cc ('k') | no next file » | 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) 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 "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/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #endif 67 #endif
68 68
69 namespace views { 69 namespace views {
70 70
71 namespace { 71 namespace {
72 72
73 void SetRestoreBounds(aura::Window* window, const gfx::Rect& bounds) { 73 void SetRestoreBounds(aura::Window* window, const gfx::Rect& bounds) {
74 window->SetProperty(aura::client::kRestoreBoundsKey, new gfx::Rect(bounds)); 74 window->SetProperty(aura::client::kRestoreBoundsKey, new gfx::Rect(bounds));
75 } 75 }
76 76
77 void SetIcon(aura::Window* window,
78 const aura::WindowProperty<gfx::ImageSkia*>* key,
79 const gfx::ImageSkia& value) {
80 if (value.isNull())
81 window->ClearProperty(key);
82 else
83 window->SetProperty(key, new gfx::ImageSkia(value));
84 }
85
86 } // namespace 77 } // namespace
87 78
88 //////////////////////////////////////////////////////////////////////////////// 79 ////////////////////////////////////////////////////////////////////////////////
89 // NativeWidgetAura, public: 80 // NativeWidgetAura, public:
90 81
91 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate) 82 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate)
92 : delegate_(delegate), 83 : delegate_(delegate),
93 window_(new aura::Window(this)), 84 window_(new aura::Window(this)),
94 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), 85 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
95 destroying_(false), 86 destroying_(false),
96 cursor_(gfx::kNullCursor), 87 cursor_(gfx::kNullCursor),
97 saved_window_state_(ui::SHOW_STATE_DEFAULT), 88 saved_window_state_(ui::SHOW_STATE_DEFAULT),
98 close_widget_factory_(this) { 89 close_widget_factory_(this) {
99 aura::client::SetFocusChangeObserver(window_, this); 90 aura::client::SetFocusChangeObserver(window_, this);
100 aura::client::SetActivationChangeObserver(window_, this); 91 aura::client::SetActivationChangeObserver(window_, this);
101 } 92 }
102 93
103 // static 94 // static
104 void NativeWidgetAura::RegisterNativeWidgetForWindow( 95 void NativeWidgetAura::RegisterNativeWidgetForWindow(
105 internal::NativeWidgetPrivate* native_widget, 96 internal::NativeWidgetPrivate* native_widget,
106 aura::Window* window) { 97 aura::Window* window) {
107 window->set_user_data(native_widget); 98 window->set_user_data(native_widget);
108 } 99 }
109 100
110 // static 101 // static
111 void NativeWidgetAura::AssignIconToAuraWindow(aura::Window* window, 102 void NativeWidgetAura::AssignIconToAuraWindow(aura::Window* window,
112 const gfx::ImageSkia& window_icon, 103 const gfx::ImageSkia& window_icon,
113 const gfx::ImageSkia& app_icon) { 104 const gfx::ImageSkia& app_icon) {
114 if (window) { 105 if (!window)
115 SetIcon(window, aura::client::kWindowIconKey, window_icon); 106 return;
116 SetIcon(window, aura::client::kAppIconKey, app_icon); 107
108 if (window_icon.isNull() && app_icon.isNull()) {
109 window->ClearProperty(aura::client::kWindowIconKey);
110 return;
117 } 111 }
112
113 window->SetProperty(
114 aura::client::kWindowIconKey,
115 new gfx::ImageSkia(!window_icon.isNull() ? window_icon : app_icon));
118 } 116 }
119 117
120 //////////////////////////////////////////////////////////////////////////////// 118 ////////////////////////////////////////////////////////////////////////////////
121 // NativeWidgetAura, internal::NativeWidgetPrivate implementation: 119 // NativeWidgetAura, internal::NativeWidgetPrivate implementation:
122 120
123 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { 121 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
124 // Aura needs to know which desktop (Ash or regular) will manage this widget. 122 // Aura needs to know which desktop (Ash or regular) will manage this widget.
125 // See Widget::InitParams::context for details. 123 // See Widget::InitParams::context for details.
126 DCHECK(params.parent || params.context); 124 DCHECK(params.parent || params.context);
127 125
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 gfx::NativeView native_view) { 1214 gfx::NativeView native_view) {
1217 aura::client::CaptureClient* capture_client = 1215 aura::client::CaptureClient* capture_client =
1218 aura::client::GetCaptureClient(native_view->GetRootWindow()); 1216 aura::client::GetCaptureClient(native_view->GetRootWindow());
1219 if (!capture_client) 1217 if (!capture_client)
1220 return nullptr; 1218 return nullptr;
1221 return capture_client->GetGlobalCaptureWindow(); 1219 return capture_client->GetGlobalCaptureWindow();
1222 } 1220 }
1223 1221
1224 } // namespace internal 1222 } // namespace internal
1225 } // namespace views 1223 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698