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

Side by Side Diff: chrome/browser/extensions/extension_host.h

Issue 150213: Add a ExtensionBrowserTest base class (Closed)
Patch Set: added timeouts fixed other tests Created 11 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
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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_EXTENSIONS_EXTENSION_HOST_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 14 matching lines...) Expand all
25 struct WebPreferences; 25 struct WebPreferences;
26 26
27 // This class is the browser component of an extension component's RenderView. 27 // This class is the browser component of an extension component's RenderView.
28 // It handles setting up the renderer process, if needed, with special 28 // It handles setting up the renderer process, if needed, with special
29 // privileges available to extensions. It may have a view to be shown in the 29 // privileges available to extensions. It may have a view to be shown in the
30 // in the browser UI, or it may be hidden. 30 // in the browser UI, or it may be hidden.
31 class ExtensionHost : public RenderViewHostDelegate, 31 class ExtensionHost : public RenderViewHostDelegate,
32 public RenderViewHostDelegate::View, 32 public RenderViewHostDelegate::View,
33 public ExtensionFunctionDispatcher::Delegate { 33 public ExtensionFunctionDispatcher::Delegate {
34 public: 34 public:
35 // Enable DOM automation in created render view hosts.
36 static void EnableDOMAutomation() { enable_dom_automation_ = true; }
37
35 ExtensionHost(Extension* extension, SiteInstance* site_instance, 38 ExtensionHost(Extension* extension, SiteInstance* site_instance,
36 const GURL& url); 39 const GURL& url);
37 ~ExtensionHost(); 40 ~ExtensionHost();
38 41
39 #if defined(TOOLKIT_VIEWS) 42 #if defined(TOOLKIT_VIEWS)
40 void set_view(ExtensionView* view) { view_.reset(view); } 43 void set_view(ExtensionView* view) { view_.reset(view); }
41 ExtensionView* view() const { return view_.get(); } 44 ExtensionView* view() const { return view_.get(); }
42 #endif 45 #endif
43 46
44 // Create an ExtensionView and tie it to this host and |browser|. 47 // Create an ExtensionView and tie it to this host and |browser|.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 virtual void StartDragging(const WebDropData& drop_data); 100 virtual void StartDragging(const WebDropData& drop_data);
98 virtual void UpdateDragCursor(bool is_drop_target); 101 virtual void UpdateDragCursor(bool is_drop_target);
99 virtual void GotFocus(); 102 virtual void GotFocus();
100 virtual void TakeFocus(bool reverse); 103 virtual void TakeFocus(bool reverse);
101 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); 104 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
102 virtual void HandleMouseEvent(); 105 virtual void HandleMouseEvent();
103 virtual void HandleMouseLeave(); 106 virtual void HandleMouseLeave();
104 virtual void UpdatePreferredWidth(int pref_width); 107 virtual void UpdatePreferredWidth(int pref_width);
105 108
106 private: 109 private:
110 // Whether to allow DOM automation for created RenderViewHosts. This is used
111 // for testing.
112 static bool enable_dom_automation_;
113
107 // ExtensionFunctionDispatcher::Delegate 114 // ExtensionFunctionDispatcher::Delegate
108 // If this ExtensionHost has a view, this returns the Browser that view is a 115 // If this ExtensionHost has a view, this returns the Browser that view is a
109 // part of. If this is a global background page, we use the active Browser 116 // part of. If this is a global background page, we use the active Browser
110 // instead. 117 // instead.
111 virtual Browser* GetBrowser(); 118 virtual Browser* GetBrowser();
112 119
113 // The extension that we're hosting in this view. 120 // The extension that we're hosting in this view.
114 Extension* extension_; 121 Extension* extension_;
115 122
116 // The profile that this host is tied to. 123 // The profile that this host is tied to.
(...skipping 15 matching lines...) Expand all
132 139
133 // The URL being hosted. 140 // The URL being hosted.
134 GURL url_; 141 GURL url_;
135 142
136 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; 143 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
137 144
138 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); 145 DISALLOW_COPY_AND_ASSIGN(ExtensionHost);
139 }; 146 };
140 147
141 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ 148 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertests_misc.cc ('k') | chrome/browser/extensions/extension_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698