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

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: Remove duplicate code 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 return;
sky 2016/08/09 22:32:25 This should clear the property.
qiangchen 2016/08/09 22:53:55 Ah, you are right. I just thought the use case tha
109
110 window->SetProperty(
111 aura::client::kWindowIconKey,
112 new gfx::ImageSkia(!window_icon.isNull() ? window_icon : app_icon));
113 }
114
100 //////////////////////////////////////////////////////////////////////////////// 115 ////////////////////////////////////////////////////////////////////////////////
101 // NativeWidgetAura, internal::NativeWidgetPrivate implementation: 116 // NativeWidgetAura, internal::NativeWidgetPrivate implementation:
102 117
103 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { 118 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
104 // Aura needs to know which desktop (Ash or regular) will manage this widget. 119 // Aura needs to know which desktop (Ash or regular) will manage this widget.
105 // See Widget::InitParams::context for details. 120 // See Widget::InitParams::context for details.
106 DCHECK(params.parent || params.context); 121 DCHECK(params.parent || params.context);
107 122
108 ownership_ = params.ownership; 123 ownership_ = params.ownership;
109 124
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 if (!window_) 363 if (!window_)
349 return false; 364 return false;
350 if (window_->title() == title) 365 if (window_->title() == title)
351 return false; 366 return false;
352 window_->SetTitle(title); 367 window_->SetTitle(title);
353 return true; 368 return true;
354 } 369 }
355 370
356 void NativeWidgetAura::SetWindowIcons(const gfx::ImageSkia& window_icon, 371 void NativeWidgetAura::SetWindowIcons(const gfx::ImageSkia& window_icon,
357 const gfx::ImageSkia& app_icon) { 372 const gfx::ImageSkia& app_icon) {
358 // Aura doesn't have window icons. 373 AssignIconToAuraWindow(window_, window_icon, app_icon);
359 } 374 }
360 375
361 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) { 376 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) {
362 if (modal_type != ui::MODAL_TYPE_NONE) 377 if (modal_type != ui::MODAL_TYPE_NONE)
363 window_->SetProperty(aura::client::kModalKey, modal_type); 378 window_->SetProperty(aura::client::kModalKey, modal_type);
364 } 379 }
365 380
366 gfx::Rect NativeWidgetAura::GetWindowBoundsInScreen() const { 381 gfx::Rect NativeWidgetAura::GetWindowBoundsInScreen() const {
367 return window_ ? window_->GetBoundsInScreen() : gfx::Rect(); 382 return window_ ? window_->GetBoundsInScreen() : gfx::Rect();
368 } 383 }
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 gfx::NativeView native_view) { 1211 gfx::NativeView native_view) {
1197 aura::client::CaptureClient* capture_client = 1212 aura::client::CaptureClient* capture_client =
1198 aura::client::GetCaptureClient(native_view->GetRootWindow()); 1213 aura::client::GetCaptureClient(native_view->GetRootWindow());
1199 if (!capture_client) 1214 if (!capture_client)
1200 return nullptr; 1215 return nullptr;
1201 return capture_client->GetGlobalCaptureWindow(); 1216 return capture_client->GetGlobalCaptureWindow();
1202 } 1217 }
1203 1218
1204 } // namespace internal 1219 } // namespace internal
1205 } // namespace views 1220 } // 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