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

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

Issue 341089: Implement window.alert() and its cousins for extensions.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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) 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"
11 #include "chrome/browser/extensions/extension_function_dispatcher.h" 11 #include "chrome/browser/extensions/extension_function_dispatcher.h"
12 #include "chrome/browser/jsmessage_box_client.h"
12 #include "chrome/browser/renderer_host/render_view_host_delegate.h" 13 #include "chrome/browser/renderer_host/render_view_host_delegate.h"
13 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" 14 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
14 #if defined(TOOLKIT_VIEWS) 15 #if defined(TOOLKIT_VIEWS)
15 #include "chrome/browser/views/browser_bubble.h" 16 #include "chrome/browser/views/browser_bubble.h"
16 #include "chrome/browser/views/extensions/extension_view.h" 17 #include "chrome/browser/views/extensions/extension_view.h"
17 #elif defined(OS_LINUX) 18 #elif defined(OS_LINUX)
18 #include "chrome/browser/gtk/extension_view_gtk.h" 19 #include "chrome/browser/gtk/extension_view_gtk.h"
19 #elif defined(OS_MACOSX) 20 #elif defined(OS_MACOSX)
20 #include "chrome/browser/cocoa/extension_view_mac.h" 21 #include "chrome/browser/cocoa/extension_view_mac.h"
21 #endif 22 #endif
(...skipping 16 matching lines...) Expand all
38 // It handles setting up the renderer process, if needed, with special 39 // It handles setting up the renderer process, if needed, with special
39 // privileges available to extensions. It may have a view to be shown in the 40 // privileges available to extensions. It may have a view to be shown in the
40 // in the browser UI, or it may be hidden. 41 // in the browser UI, or it may be hidden.
41 class ExtensionHost : // NOLINT 42 class ExtensionHost : // NOLINT
42 #if defined(TOOLKIT_VIEWS) 43 #if defined(TOOLKIT_VIEWS)
43 public BrowserBubble::Delegate, 44 public BrowserBubble::Delegate,
44 #endif 45 #endif
45 public RenderViewHostDelegate, 46 public RenderViewHostDelegate,
46 public RenderViewHostDelegate::View, 47 public RenderViewHostDelegate::View,
47 public ExtensionFunctionDispatcher::Delegate, 48 public ExtensionFunctionDispatcher::Delegate,
48 public NotificationObserver { 49 public NotificationObserver,
50 public JavaScriptMessageBoxClient {
49 public: 51 public:
50 class ProcessCreationQueue; 52 class ProcessCreationQueue;
51 53
52 // Enable DOM automation in created render view hosts. 54 // Enable DOM automation in created render view hosts.
53 static void EnableDOMAutomation() { enable_dom_automation_ = true; } 55 static void EnableDOMAutomation() { enable_dom_automation_ = true; }
54 56
55 ExtensionHost(Extension* extension, SiteInstance* site_instance, 57 ExtensionHost(Extension* extension, SiteInstance* site_instance,
56 const GURL& url, ViewType::Type host_type); 58 const GURL& url, ViewType::Type host_type);
57 ~ExtensionHost(); 59 ~ExtensionHost();
58 60
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 virtual bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); 169 virtual bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
168 virtual void HandleMouseEvent(); 170 virtual void HandleMouseEvent();
169 virtual void HandleMouseLeave(); 171 virtual void HandleMouseLeave();
170 virtual void UpdatePreferredSize(const gfx::Size& new_size); 172 virtual void UpdatePreferredSize(const gfx::Size& new_size);
171 173
172 // NotificationObserver 174 // NotificationObserver
173 virtual void Observe(NotificationType type, 175 virtual void Observe(NotificationType type,
174 const NotificationSource& source, 176 const NotificationSource& source,
175 const NotificationDetails& details); 177 const NotificationDetails& details);
176 178
179 // JavaScriptMessageBoxClient
180 virtual std::wstring GetMessageBoxTitle(const GURL& frame_url,
181 bool is_alert);
182 virtual gfx::NativeWindow GetMessageBoxRootWindow();
183 virtual void OnMessageBoxClosed(IPC::Message* reply_msg,
184 bool success,
185 const std::wstring& prompt);
186 virtual void SetSuppressMessageBoxes(bool suppress_message_boxes) {}
187 virtual TabContents* AsTabContents() { return NULL; }
188
177 private: 189 private:
178 friend class ProcessCreationQueue; 190 friend class ProcessCreationQueue;
179 191
180 // Whether to allow DOM automation for created RenderViewHosts. This is used 192 // Whether to allow DOM automation for created RenderViewHosts. This is used
181 // for testing. 193 // for testing.
182 static bool enable_dom_automation_; 194 static bool enable_dom_automation_;
183 195
184 // Actually create the RenderView for this host. See CreateRenderViewSoon. 196 // Actually create the RenderView for this host. See CreateRenderViewSoon.
185 void CreateRenderViewNow(); 197 void CreateRenderViewNow();
186 198
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; 248 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
237 249
238 // Only EXTENSION_TOOLSTRIP, EXTENSION_POPUP, and EXTENSION_BACKGROUND_PAGE 250 // Only EXTENSION_TOOLSTRIP, EXTENSION_POPUP, and EXTENSION_BACKGROUND_PAGE
239 // are used here, others are not hosted by ExtensionHost. 251 // are used here, others are not hosted by ExtensionHost.
240 ViewType::Type extension_host_type_; 252 ViewType::Type extension_host_type_;
241 253
242 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); 254 DISALLOW_COPY_AND_ASSIGN(ExtensionHost);
243 }; 255 };
244 256
245 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ 257 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698