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

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

Issue 9600036: Move Render(View|Widget)Host and associated classes to content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 8 years, 9 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_EXTENSIONS_EXTENSION_FUNCTION_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <string> 10 #include <string>
(...skipping 13 matching lines...) Expand all
24 #include "ipc/ipc_message.h" 24 #include "ipc/ipc_message.h"
25 25
26 class Browser; 26 class Browser;
27 class ChromeRenderMessageFilter; 27 class ChromeRenderMessageFilter;
28 class ExtensionFunction; 28 class ExtensionFunction;
29 class ExtensionFunctionDispatcher; 29 class ExtensionFunctionDispatcher;
30 class UIThreadExtensionFunction; 30 class UIThreadExtensionFunction;
31 class IOThreadExtensionFunction; 31 class IOThreadExtensionFunction;
32 class Profile; 32 class Profile;
33 class QuotaLimitHeuristic; 33 class QuotaLimitHeuristic;
34 class RenderViewHost;
35 34
36 namespace base { 35 namespace base {
37 class ListValue; 36 class ListValue;
38 class Value; 37 class Value;
39 } 38 }
40 39
40 namespace content {
41 class RenderViewHost;
42 }
43
41 #define EXTENSION_FUNCTION_VALIDATE(test) do { \ 44 #define EXTENSION_FUNCTION_VALIDATE(test) do { \
42 if (!(test)) { \ 45 if (!(test)) { \
43 bad_message_ = true; \ 46 bad_message_ = true; \
44 return false; \ 47 return false; \
45 } \ 48 } \
46 } while (0) 49 } while (0)
47 50
48 #define EXTENSION_FUNCTION_ERROR(error) do { \ 51 #define EXTENSION_FUNCTION_ERROR(error) do { \
49 error_ = error; \ 52 error_ = error; \
50 bad_message_ = true; \ 53 bad_message_ = true; \
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 233
231 // Called when a message was received. 234 // Called when a message was received.
232 // Should return true if it processed the message. 235 // Should return true if it processed the message.
233 virtual bool OnMessageReceivedFromRenderView(const IPC::Message& message); 236 virtual bool OnMessageReceivedFromRenderView(const IPC::Message& message);
234 237
235 // Set the profile which contains the extension that has originated this 238 // Set the profile which contains the extension that has originated this
236 // function call. 239 // function call.
237 void set_profile(Profile* profile) { profile_ = profile; } 240 void set_profile(Profile* profile) { profile_ = profile; }
238 Profile* profile() const { return profile_; } 241 Profile* profile() const { return profile_; }
239 242
240 void SetRenderViewHost(RenderViewHost* render_view_host); 243 void SetRenderViewHost(content::RenderViewHost* render_view_host);
241 RenderViewHost* render_view_host() const { return render_view_host_; } 244 content::RenderViewHost* render_view_host() const {
245 return render_view_host_;
246 }
242 247
243 void set_dispatcher( 248 void set_dispatcher(
244 const base::WeakPtr<ExtensionFunctionDispatcher>& dispatcher) { 249 const base::WeakPtr<ExtensionFunctionDispatcher>& dispatcher) {
245 dispatcher_ = dispatcher; 250 dispatcher_ = dispatcher;
246 } 251 }
247 ExtensionFunctionDispatcher* dispatcher() const { 252 ExtensionFunctionDispatcher* dispatcher() const {
248 return dispatcher_.get(); 253 return dispatcher_.get();
249 } 254 }
250 255
251 // Gets the "current" browser, if any. 256 // Gets the "current" browser, if any.
(...skipping 20 matching lines...) Expand all
272 friend class base::DeleteHelper<UIThreadExtensionFunction>; 277 friend class base::DeleteHelper<UIThreadExtensionFunction>;
273 278
274 virtual ~UIThreadExtensionFunction(); 279 virtual ~UIThreadExtensionFunction();
275 280
276 virtual void SendResponse(bool success) OVERRIDE; 281 virtual void SendResponse(bool success) OVERRIDE;
277 282
278 // The dispatcher that will service this extension function call. 283 // The dispatcher that will service this extension function call.
279 base::WeakPtr<ExtensionFunctionDispatcher> dispatcher_; 284 base::WeakPtr<ExtensionFunctionDispatcher> dispatcher_;
280 285
281 // The RenderViewHost we will send responses too. 286 // The RenderViewHost we will send responses too.
282 RenderViewHost* render_view_host_; 287 content::RenderViewHost* render_view_host_;
283 288
284 // The Profile of this function's extension. 289 // The Profile of this function's extension.
285 Profile* profile_; 290 Profile* profile_;
286 291
287 private: 292 private:
288 // Helper class to track the lifetime of ExtensionFunction's RenderViewHost 293 // Helper class to track the lifetime of ExtensionFunction's RenderViewHost
289 // pointer and NULL it out when it dies. It also allows us to filter IPC 294 // pointer and NULL it out when it dies. It also allows us to filter IPC
290 // messages coming from the RenderViewHost. We use this separate class 295 // messages coming from the RenderViewHost. We use this separate class
291 // (instead of implementing NotificationObserver on ExtensionFunction) because 296 // (instead of implementing NotificationObserver on ExtensionFunction) because
292 // it is/ common for subclasses of ExtensionFunction to be 297 // it is/ common for subclasses of ExtensionFunction to be
293 // NotificationObservers, and it would be an easy error to forget to call the 298 // NotificationObservers, and it would be an easy error to forget to call the
294 // base class's Observe() method. 299 // base class's Observe() method.
295 class RenderViewHostTracker : public content::NotificationObserver, 300 class RenderViewHostTracker : public content::NotificationObserver,
296 public content::RenderViewHostObserver { 301 public content::RenderViewHostObserver {
297 public: 302 public:
298 RenderViewHostTracker(UIThreadExtensionFunction* function, 303 RenderViewHostTracker(UIThreadExtensionFunction* function,
299 RenderViewHost* render_view_host); 304 content::RenderViewHost* render_view_host);
300 private: 305 private:
301 virtual void Observe(int type, 306 virtual void Observe(int type,
302 const content::NotificationSource& source, 307 const content::NotificationSource& source,
303 const content::NotificationDetails& details) OVERRIDE; 308 const content::NotificationDetails& details) OVERRIDE;
304 309
305 virtual void RenderViewHostDestroyed( 310 virtual void RenderViewHostDestroyed(
306 RenderViewHost* render_view_host) OVERRIDE; 311 content::RenderViewHost* render_view_host) OVERRIDE;
307 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 312 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
308 313
309 UIThreadExtensionFunction* function_; 314 UIThreadExtensionFunction* function_;
310 content::NotificationRegistrar registrar_; 315 content::NotificationRegistrar registrar_;
311 316
312 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTracker); 317 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTracker);
313 }; 318 };
314 319
315 virtual void Destruct() const OVERRIDE; 320 virtual void Destruct() const OVERRIDE;
316 321
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 public: 404 public:
400 SyncIOThreadExtensionFunction(); 405 SyncIOThreadExtensionFunction();
401 406
402 virtual void Run() OVERRIDE; 407 virtual void Run() OVERRIDE;
403 408
404 protected: 409 protected:
405 virtual ~SyncIOThreadExtensionFunction(); 410 virtual ~SyncIOThreadExtensionFunction();
406 }; 411 };
407 412
408 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ 413 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_debugger_api.cc ('k') | chrome/browser/extensions/extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698