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

Side by Side Diff: extensions/components/native_app_window/native_app_window_views.cc

Issue 2738373002: Enhance chrome.app.window API with window background color (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/components/native_app_window/native_app_window_views.h" 5 #include "extensions/components/native_app_window/native_app_window_views.h"
6 6
7 #include "base/threading/sequenced_worker_pool.h" 7 #include "base/threading/sequenced_worker_pool.h"
8 #include "content/public/browser/render_view_host.h" 8 #include "content/public/browser/render_view_host.h"
9 #include "content/public/browser/render_widget_host.h" 9 #include "content/public/browser/render_widget_host.h"
10 #include "content/public/browser/render_widget_host_view.h" 10 #include "content/public/browser/render_widget_host_view.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 bool active) { 284 bool active) {
285 app_window_->OnNativeWindowChanged(); 285 app_window_->OnNativeWindowChanged();
286 if (active) 286 if (active)
287 app_window_->OnNativeWindowActivated(); 287 app_window_->OnNativeWindowActivated();
288 } 288 }
289 289
290 // WebContentsObserver implementation. 290 // WebContentsObserver implementation.
291 291
292 void NativeAppWindowViews::RenderViewCreated( 292 void NativeAppWindowViews::RenderViewCreated(
293 content::RenderViewHost* render_view_host) { 293 content::RenderViewHost* render_view_host) {
294 content::RenderWidgetHostView* view =
295 render_view_host->GetWidget()->GetView();
296 DCHECK(view);
297
294 if (app_window_->requested_alpha_enabled() && CanHaveAlphaEnabled()) { 298 if (app_window_->requested_alpha_enabled() && CanHaveAlphaEnabled()) {
295 content::RenderWidgetHostView* view =
296 render_view_host->GetWidget()->GetView();
297 DCHECK(view);
298 view->SetBackgroundColor(SK_ColorTRANSPARENT); 299 view->SetBackgroundColor(SK_ColorTRANSPARENT);
Reilly Grant (use Gerrit) 2017/03/10 18:39:18 This implies that background color and alpha are m
300 } else if (app_window_->backgroundColor() != SK_ColorWHITE) {
301 view->SetBackgroundColor(app_window_->backgroundColor());
299 } 302 }
300 } 303 }
301 304
302 void NativeAppWindowViews::RenderViewHostChanged( 305 void NativeAppWindowViews::RenderViewHostChanged(
303 content::RenderViewHost* old_host, 306 content::RenderViewHost* old_host,
304 content::RenderViewHost* new_host) { 307 content::RenderViewHost* new_host) {
305 OnViewWasResized(); 308 OnViewWasResized();
306 } 309 }
307 310
308 // views::View implementation. 311 // views::View implementation.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 436
434 bool NativeAppWindowViews::CanHaveAlphaEnabled() const { 437 bool NativeAppWindowViews::CanHaveAlphaEnabled() const {
435 return widget_->IsTranslucentWindowOpacitySupported(); 438 return widget_->IsTranslucentWindowOpacitySupported();
436 } 439 }
437 440
438 void NativeAppWindowViews::SetVisibleOnAllWorkspaces(bool always_visible) { 441 void NativeAppWindowViews::SetVisibleOnAllWorkspaces(bool always_visible) {
439 widget_->SetVisibleOnAllWorkspaces(always_visible); 442 widget_->SetVisibleOnAllWorkspaces(always_visible);
440 } 443 }
441 444
442 } // namespace native_app_window 445 } // namespace native_app_window
OLDNEW
« extensions/common/api/app_window.idl ('K') | « extensions/common/api/app_window.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698