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

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

Issue 6251001: Move chrome/browser/gtk/ to chrome/browser/ui/gtk/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/gtk/extension_view_gtk.h"
6
7 #include "chrome/browser/extensions/extension_host.h"
8 #include "chrome/browser/gtk/extension_popup_gtk.h"
9 #include "chrome/browser/renderer_host/render_view_host.h"
10 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
11
12 ExtensionViewGtk::ExtensionViewGtk(ExtensionHost* extension_host,
13 Browser* browser)
14 : browser_(browser),
15 extension_host_(extension_host),
16 render_widget_host_view_(NULL),
17 container_(NULL) {
18 }
19
20 void ExtensionViewGtk::Init() {
21 CreateWidgetHostView();
22 }
23
24 gfx::NativeView ExtensionViewGtk::native_view() {
25 return render_widget_host_view_->native_view();
26 }
27
28 RenderViewHost* ExtensionViewGtk::render_view_host() const {
29 return extension_host_->render_view_host();
30 }
31
32 void ExtensionViewGtk::SetBackground(const SkBitmap& background) {
33 if (render_view_host()->IsRenderViewLive()) {
34 render_widget_host_view_->SetBackground(background);
35 } else {
36 pending_background_ = background;
37 }
38 }
39
40 void ExtensionViewGtk::UpdatePreferredSize(const gfx::Size& new_size) {
41 if (container_)
42 container_->OnExtensionPreferredSizeChanged(this, new_size);
43 }
44
45 void ExtensionViewGtk::CreateWidgetHostView() {
46 DCHECK(!render_widget_host_view_);
47 render_widget_host_view_ = new RenderWidgetHostViewGtk(render_view_host());
48 render_widget_host_view_->InitAsChild();
49
50 extension_host_->CreateRenderViewSoon(render_widget_host_view_);
51 }
52
53 void ExtensionViewGtk::RenderViewCreated() {
54 if (!pending_background_.empty() && render_view_host()->view()) {
55 render_widget_host_view_->SetBackground(pending_background_);
56 pending_background_.reset();
57 }
58
59 // Tell the renderer not to draw scrollbars in popups unless the
60 // popups are at the maximum allowed size.
61 gfx::Size largest_popup_size(ExtensionPopupGtk::kMaxWidth,
62 ExtensionPopupGtk::kMaxHeight);
63 extension_host_->DisableScrollbarsForSmallWindows(largest_popup_size);
64 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/extension_view_gtk.h ('k') | chrome/browser/gtk/external_protocol_dialog_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698