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

Side by Side Diff: chrome/browser/ui/gtk/extensions/extension_view_gtk.cc

Issue 9702068: Move extension pop-ups and notifications to the new auto-resize code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: small update Created 8 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 | 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/gtk/extensions/extension_view_gtk.h" 5 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h"
6 6
7 #include "chrome/browser/extensions/extension_host.h" 7 #include "chrome/browser/extensions/extension_host.h"
8 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" 8 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h"
9 #include "chrome/common/chrome_view_type.h"
9 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
10 #include "content/public/browser/render_widget_host_view.h" 11 #include "content/public/browser/render_widget_host_view.h"
11 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
12 #include "content/public/browser/web_contents_view.h" 13 #include "content/public/browser/web_contents_view.h"
13 14
14 ExtensionViewGtk::ExtensionViewGtk(ExtensionHost* extension_host, 15 ExtensionViewGtk::ExtensionViewGtk(ExtensionHost* extension_host,
15 Browser* browser) 16 Browser* browser)
16 : browser_(browser), 17 : browser_(browser),
17 extension_host_(extension_host), 18 extension_host_(extension_host),
18 container_(NULL) { 19 container_(NULL) {
(...skipping 12 matching lines...) Expand all
31 } 32 }
32 33
33 void ExtensionViewGtk::SetBackground(const SkBitmap& background) { 34 void ExtensionViewGtk::SetBackground(const SkBitmap& background) {
34 if (render_view_host()->IsRenderViewLive() && render_view_host()->GetView()) { 35 if (render_view_host()->IsRenderViewLive() && render_view_host()->GetView()) {
35 render_view_host()->GetView()->SetBackground(background); 36 render_view_host()->GetView()->SetBackground(background);
36 } else { 37 } else {
37 pending_background_ = background; 38 pending_background_ = background;
38 } 39 }
39 } 40 }
40 41
41 void ExtensionViewGtk::UpdatePreferredSize(const gfx::Size& new_size) { 42 void ExtensionViewGtk::ResizeDueToAutoResize(const gfx::Size& new_size) {
42 if (container_) 43 if (container_)
43 container_->OnExtensionPreferredSizeChanged(this, new_size); 44 container_->OnExtensionSizeChanged(this, new_size);
44 } 45 }
45 46
46 void ExtensionViewGtk::CreateWidgetHostView() { 47 void ExtensionViewGtk::CreateWidgetHostView() {
47 extension_host_->CreateRenderViewSoon(); 48 extension_host_->CreateRenderViewSoon();
48 } 49 }
49 50
50 void ExtensionViewGtk::RenderViewCreated() { 51 void ExtensionViewGtk::RenderViewCreated() {
51 if (!pending_background_.empty() && render_view_host()->GetView()) { 52 if (!pending_background_.empty() && render_view_host()->GetView()) {
52 render_view_host()->GetView()->SetBackground(pending_background_); 53 render_view_host()->GetView()->SetBackground(pending_background_);
53 pending_background_.reset(); 54 pending_background_.reset();
54 } 55 }
55 56
56 // Tell the renderer not to draw scrollbars in popups unless the 57 content::ViewType host_type = extension_host_->extension_host_type();
57 // popups are at the maximum allowed size. 58 if (host_type == chrome::VIEW_TYPE_EXTENSION_POPUP) {
58 gfx::Size largest_popup_size(ExtensionPopupGtk::kMaxWidth, 59 gfx::Size min_size(ExtensionPopupGtk::kMinWidth,
59 ExtensionPopupGtk::kMaxHeight); 60 ExtensionPopupGtk::kMinHeight);
60 extension_host_->DisableScrollbarsForSmallWindows(largest_popup_size); 61 gfx::Size max_size(ExtensionPopupGtk::kMaxWidth,
62 ExtensionPopupGtk::kMaxHeight);
63 render_view_host()->EnableAutoResize(min_size, max_size);
64 }
61 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698