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

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

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 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) 2012 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/ui/gtk/extensions/extension_view_gtk.h"
6
7 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h"
8 #include "content/public/browser/render_view_host.h"
9 #include "content/public/browser/render_widget_host_view.h"
10 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_contents_view.h"
12 #include "extensions/browser/extension_host.h"
13 #include "extensions/common/view_type.h"
14
15 ExtensionViewGtk::ExtensionViewGtk(extensions::ExtensionHost* extension_host,
16 Browser* browser)
17 : browser_(browser),
18 extension_host_(extension_host),
19 container_(NULL) {
20 }
21
22 void ExtensionViewGtk::Init() {
23 CreateWidgetHostView();
24 }
25
26 gfx::NativeView ExtensionViewGtk::native_view() {
27 return extension_host_->host_contents()->GetView()->GetNativeView();
28 }
29
30 content::RenderViewHost* ExtensionViewGtk::render_view_host() const {
31 return extension_host_->render_view_host();
32 }
33
34 void ExtensionViewGtk::SetBackground(const SkBitmap& background) {
35 if (render_view_host()->IsRenderViewLive() && render_view_host()->GetView()) {
36 render_view_host()->GetView()->SetBackground(background);
37 } else {
38 pending_background_ = background;
39 }
40 }
41
42 void ExtensionViewGtk::ResizeDueToAutoResize(const gfx::Size& new_size) {
43 if (container_)
44 container_->OnExtensionSizeChanged(this, new_size);
45 }
46
47 void ExtensionViewGtk::CreateWidgetHostView() {
48 extension_host_->CreateRenderViewSoon();
49 }
50
51 void ExtensionViewGtk::RenderViewCreated() {
52 if (!pending_background_.empty() && render_view_host()->GetView()) {
53 render_view_host()->GetView()->SetBackground(pending_background_);
54 pending_background_.reset();
55 }
56
57 extensions::ViewType host_type = extension_host_->extension_host_type();
58 if (host_type == extensions::VIEW_TYPE_EXTENSION_POPUP) {
59 gfx::Size min_size(ExtensionPopupGtk::kMinWidth,
60 ExtensionPopupGtk::kMinHeight);
61 gfx::Size max_size(ExtensionPopupGtk::kMaxWidth,
62 ExtensionPopupGtk::kMaxHeight);
63 render_view_host()->EnableAutoResize(min_size, max_size);
64 }
65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698