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

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

Issue 2222703002: Aura Icon Capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clear Property When Null Created 4 years, 4 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
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 aura::client::SetActivationChangeObserver(window_, this); 90 aura::client::SetActivationChangeObserver(window_, this);
91 } 91 }
92 92
93 // static 93 // static
94 void NativeWidgetAura::RegisterNativeWidgetForWindow( 94 void NativeWidgetAura::RegisterNativeWidgetForWindow(
95 internal::NativeWidgetPrivate* native_widget, 95 internal::NativeWidgetPrivate* native_widget,
96 aura::Window* window) { 96 aura::Window* window) {
97 window->set_user_data(native_widget); 97 window->set_user_data(native_widget);
98 } 98 }
99 99
100 // static
101 void NativeWidgetAura::AssignIconToAuraWindow(aura::Window* window,
102 const gfx::ImageSkia& window_icon,
103 const gfx::ImageSkia& app_icon) {
104 if (!window)
105 return;
106
107 if (window_icon.isNull() && app_icon.isNull()) {
108 window->ClearProperty(aura::client::kWindowIconKey);
109 return;
110 }
111
112 window->SetProperty(
113 aura::client::kWindowIconKey,
114 new gfx::ImageSkia(!window_icon.isNull() ? window_icon : app_icon));
115 }
116
100 //////////////////////////////////////////////////////////////////////////////// 117 ////////////////////////////////////////////////////////////////////////////////
101 // NativeWidgetAura, internal::NativeWidgetPrivate implementation: 118 // NativeWidgetAura, internal::NativeWidgetPrivate implementation:
102 119
103 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { 120 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
104 // Aura needs to know which desktop (Ash or regular) will manage this widget. 121 // Aura needs to know which desktop (Ash or regular) will manage this widget.
105 // See Widget::InitParams::context for details. 122 // See Widget::InitParams::context for details.
106 DCHECK(params.parent || params.context); 123 DCHECK(params.parent || params.context);
107 124
108 ownership_ = params.ownership; 125 ownership_ = params.ownership;
109 126
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 if (!window_) 365 if (!window_)
349 return false; 366 return false;
350 if (window_->title() == title) 367 if (window_->title() == title)
351 return false; 368 return false;
352 window_->SetTitle(title); 369 window_->SetTitle(title);
353 return true; 370 return true;
354 } 371 }
355 372
356 void NativeWidgetAura::SetWindowIcons(const gfx::ImageSkia& window_icon, 373 void NativeWidgetAura::SetWindowIcons(const gfx::ImageSkia& window_icon,
357 const gfx::ImageSkia& app_icon) { 374 const gfx::ImageSkia& app_icon) {
358 // Aura doesn't have window icons. 375 AssignIconToAuraWindow(window_, window_icon, app_icon);
359 } 376 }
360 377
361 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) { 378 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) {
362 if (modal_type != ui::MODAL_TYPE_NONE) 379 if (modal_type != ui::MODAL_TYPE_NONE)
363 window_->SetProperty(aura::client::kModalKey, modal_type); 380 window_->SetProperty(aura::client::kModalKey, modal_type);
364 } 381 }
365 382
366 gfx::Rect NativeWidgetAura::GetWindowBoundsInScreen() const { 383 gfx::Rect NativeWidgetAura::GetWindowBoundsInScreen() const {
367 return window_ ? window_->GetBoundsInScreen() : gfx::Rect(); 384 return window_ ? window_->GetBoundsInScreen() : gfx::Rect();
368 } 385 }
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 gfx::NativeView native_view) { 1213 gfx::NativeView native_view) {
1197 aura::client::CaptureClient* capture_client = 1214 aura::client::CaptureClient* capture_client =
1198 aura::client::GetCaptureClient(native_view->GetRootWindow()); 1215 aura::client::GetCaptureClient(native_view->GetRootWindow());
1199 if (!capture_client) 1216 if (!capture_client)
1200 return nullptr; 1217 return nullptr;
1201 return capture_client->GetGlobalCaptureWindow(); 1218 return capture_client->GetGlobalCaptureWindow();
1202 } 1219 }
1203 1220
1204 } // namespace internal 1221 } // namespace internal
1205 } // namespace views 1222 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698