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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_view_views.h

Issue 363233002: Abstract base 'ExtensionView' to Fix DEPS violation in extension_view_host.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: respond to comments Created 6 years, 5 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 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_ 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "chrome/browser/extensions/extension_view.h"
10 #include "content/public/browser/native_web_keyboard_event.h" 11 #include "content/public/browser/native_web_keyboard_event.h"
11 #include "extensions/browser/extension_host.h" 12 #include "extensions/browser/extension_host.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "ui/views/controls/native/native_view_host.h" 14 #include "ui/views/controls/native/native_view_host.h"
14 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" 15 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
15 16
16 class Browser; 17 class Browser;
17 18
18 namespace content { 19 namespace content {
19 class RenderViewHost; 20 class RenderViewHost;
20 } 21 }
21 22
22 // This handles the display portion of an ExtensionHost. 23 // This handles the display portion of an ExtensionHost.
23 class ExtensionViewViews : public views::NativeViewHost { 24 class ExtensionViewViews : public views::NativeViewHost,
25 public extensions::ExtensionView {
24 public: 26 public:
25 // A class that represents the container that this view is in. 27 // A class that represents the container that this view is in.
26 // (bottom shelf, side bar, etc.) 28 // (bottom shelf, side bar, etc.)
27 class Container { 29 class Container {
28 public: 30 public:
29 virtual ~Container() {} 31 virtual ~Container() {}
30 32
31 virtual void OnExtensionSizeChanged(ExtensionViewViews* view) {} 33 virtual void OnExtensionSizeChanged(ExtensionViewViews* view) {}
32 }; 34 };
33 35
34 ExtensionViewViews(extensions::ExtensionHost* host, Browser* browser); 36 ExtensionViewViews(extensions::ExtensionHost* host, Browser* browser);
35 virtual ~ExtensionViewViews(); 37 virtual ~ExtensionViewViews();
36 38
37 // views::NativeViewHost: 39 // views::NativeViewHost:
38 virtual gfx::Size GetMinimumSize() const OVERRIDE; 40 virtual gfx::Size GetMinimumSize() const OVERRIDE;
39 virtual void SetVisible(bool is_visible) OVERRIDE; 41 virtual void SetVisible(bool is_visible) OVERRIDE;
40 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; 42 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE;
41 virtual void ViewHierarchyChanged( 43 virtual void ViewHierarchyChanged(
42 const ViewHierarchyChangedDetails& details) OVERRIDE; 44 const ViewHierarchyChangedDetails& details) OVERRIDE;
43 45
44 extensions::ExtensionHost* host() const { return host_; } 46 extensions::ExtensionHost* host() const { return host_; }
45 const extensions::Extension* extension() const { return host_->extension(); } 47 const extensions::Extension* extension() const { return host_->extension(); }
46 content::RenderViewHost* render_view_host() const { 48 content::RenderViewHost* render_view_host() const {
47 return host_->render_view_host(); 49 return host_->render_view_host();
48 } 50 }
49 Browser* browser() const { return browser_; }
50 void set_minimum_size(const gfx::Size& minimum_size) { 51 void set_minimum_size(const gfx::Size& minimum_size) {
51 minimum_size_ = minimum_size; 52 minimum_size_ = minimum_size;
52 } 53 }
53 void set_container(Container* container) { container_ = container; } 54 void set_container(Container* container) { container_ = container; }
54 55
55 void DidStopLoading();
56 void SetIsClipped(bool is_clipped); 56 void SetIsClipped(bool is_clipped);
57 57
58 // Notification from ExtensionHost. 58 // extensions::ExtensionView:
59 void ResizeDueToAutoResize(const gfx::Size& new_size); 59 virtual void Init() OVERRIDE;
60 60 virtual Browser* GetBrowser() OVERRIDE;
61 // Method for the ExtensionHost to notify us when the RenderViewHost has a 61 virtual gfx::NativeView GetNativeView() OVERRIDE;
62 // connection. 62 virtual void ResizeDueToAutoResize(const gfx::Size& new_size) OVERRIDE;
63 void RenderViewCreated(); 63 virtual void RenderViewCreated() OVERRIDE;
64 64 virtual void HandleKeyboardEvent(
65 // Handles unhandled keyboard messages coming back from the renderer process. 65 content::WebContents* source,
66 void HandleKeyboardEvent(const content::NativeWebKeyboardEvent& event); 66 const content::NativeWebKeyboardEvent& event) OVERRIDE;
67 virtual void DidStopLoading() OVERRIDE;
67 68
68 private: 69 private:
69 friend class extensions::ExtensionHost; 70 friend class extensions::ExtensionHost;
70 71
71 // views::NativeViewHost: 72 // views::NativeViewHost:
72 virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) OVERRIDE; 73 virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) OVERRIDE;
73 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; 74 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
74 virtual void PreferredSizeChanged() OVERRIDE; 75 virtual void PreferredSizeChanged() OVERRIDE;
75 virtual void OnFocus() OVERRIDE; 76 virtual void OnFocus() OVERRIDE;
76 77
(...skipping 30 matching lines...) Expand all
107 bool is_clipped_; 108 bool is_clipped_;
108 109
109 // A handler to handle unhandled keyboard messages coming back from the 110 // A handler to handle unhandled keyboard messages coming back from the
110 // renderer process. 111 // renderer process.
111 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; 112 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
112 113
113 DISALLOW_COPY_AND_ASSIGN(ExtensionViewViews); 114 DISALLOW_COPY_AND_ASSIGN(ExtensionViewViews);
114 }; 115 };
115 116
116 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_ 117 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698