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

Side by Side Diff: chrome/browser/ui/views/extensions/native_app_window_views.cc

Issue 10986092: Transparent apps support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 11 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 | Annotate | Revision Log
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 "chrome/browser/ui/views/extensions/native_app_window_views.h" 5 #include "chrome/browser/ui/views/extensions/native_app_window_views.h"
6 6
7 #include "chrome/browser/extensions/extension_host.h" 7 #include "chrome/browser/extensions/extension_host.h"
8 #include "chrome/browser/favicon/favicon_tab_helper.h" 8 #include "chrome/browser/favicon/favicon_tab_helper.h"
9 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views .h" 9 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views .h"
10 #include "chrome/browser/ui/views/extensions/shell_window_frame_view.h" 10 #include "chrome/browser/ui/views/extensions/shell_window_frame_view.h"
(...skipping 28 matching lines...) Expand all
39 const int kResizeInsideBoundsSize = 5; 39 const int kResizeInsideBoundsSize = 5;
40 } 40 }
41 41
42 NativeAppWindowViews::NativeAppWindowViews( 42 NativeAppWindowViews::NativeAppWindowViews(
43 ShellWindow* shell_window, 43 ShellWindow* shell_window,
44 const ShellWindow::CreateParams& create_params) 44 const ShellWindow::CreateParams& create_params)
45 : shell_window_(shell_window), 45 : shell_window_(shell_window),
46 web_view_(NULL), 46 web_view_(NULL),
47 window_(NULL), 47 window_(NULL),
48 is_fullscreen_(false), 48 is_fullscreen_(false),
49 frameless_(create_params.frame == ShellWindow::FRAME_NONE) { 49 frameless_(create_params.frame == ShellWindow::FRAME_NONE),
50 transparent_background_(create_params.transparent_background) {
51 Observe(shell_window_->web_contents());
50 minimum_size_ = create_params.minimum_size; 52 minimum_size_ = create_params.minimum_size;
51 maximum_size_ = create_params.maximum_size; 53 maximum_size_ = create_params.maximum_size;
52 54
53 window_ = new views::Widget; 55 window_ = new views::Widget;
54 if (create_params.window_type == ShellWindow::WINDOW_TYPE_PANEL) 56 if (create_params.window_type == ShellWindow::WINDOW_TYPE_PANEL)
55 InitializePanelWindow(create_params); 57 InitializePanelWindow(create_params);
56 else 58 else
57 InitializeDefaultWindow(create_params); 59 InitializeDefaultWindow(create_params);
58 60
59 extension_keybinding_registry_.reset( 61 extension_keybinding_registry_.reset(
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 void NativeAppWindowViews::OnWidgetVisibilityChanged(views::Widget* widget, 386 void NativeAppWindowViews::OnWidgetVisibilityChanged(views::Widget* widget,
385 bool visible) { 387 bool visible) {
386 shell_window_->OnNativeWindowChanged(); 388 shell_window_->OnNativeWindowChanged();
387 } 389 }
388 390
389 void NativeAppWindowViews::OnWidgetActivationChanged(views::Widget* widget, 391 void NativeAppWindowViews::OnWidgetActivationChanged(views::Widget* widget,
390 bool active) { 392 bool active) {
391 shell_window_->OnNativeWindowChanged(); 393 shell_window_->OnNativeWindowChanged();
392 } 394 }
393 395
396 // WebContentsObserver implementation.
397
398 void NativeAppWindowViews::RenderViewCreated(
399 content::RenderViewHost* render_view_host) {
400 if (transparent_background_) {
401 // Use a background with transparency to trigger transparency in Webkit.
402 SkBitmap background;
403 background.setConfig(SkBitmap::kARGB_8888_Config, 1, 1);
404 background.allocPixels();
405 background.eraseARGB(0x00, 0x00, 0x00, 0x00);
406
407 content::RenderWidgetHostView* view = render_view_host->GetView();
408 DCHECK(view);
409 view->SetBackground(background);
410 }
411 }
412
394 // views::View implementation. 413 // views::View implementation.
395 414
396 void NativeAppWindowViews::Layout() { 415 void NativeAppWindowViews::Layout() {
397 DCHECK(web_view_); 416 DCHECK(web_view_);
398 web_view_->SetBounds(0, 0, width(), height()); 417 web_view_->SetBounds(0, 0, width(), height());
399 OnViewWasResized(); 418 OnViewWasResized();
400 } 419 }
401 420
402 void NativeAppWindowViews::ViewHierarchyChanged( 421 void NativeAppWindowViews::ViewHierarchyChanged(
403 bool is_add, views::View *parent, views::View *child) { 422 bool is_add, views::View *parent, views::View *child) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 495 }
477 496
478 //------------------------------------------------------------------------------ 497 //------------------------------------------------------------------------------
479 // NativeAppWindow::Create 498 // NativeAppWindow::Create
480 499
481 // static 500 // static
482 NativeAppWindow* NativeAppWindow::Create( 501 NativeAppWindow* NativeAppWindow::Create(
483 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { 502 ShellWindow* shell_window, const ShellWindow::CreateParams& params) {
484 return new NativeAppWindowViews(shell_window, params); 503 return new NativeAppWindowViews(shell_window, params);
485 } 504 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/native_app_window_views.h ('k') | chrome/common/extensions/api/app_window.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698