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

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

Issue 8530003: Delete the temporary file when generating MHTML with the extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean-up Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/process.h" 16 #include "base/process.h"
17 #include "chrome/browser/extensions/extension_info_map.h" 17 #include "chrome/browser/extensions/extension_info_map.h"
18 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
19 #include "content/browser/renderer_host/render_view_host_observer.h"
19 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
22 #include "ipc/ipc_message.h" 23 #include "ipc/ipc_message.h"
23 24
24 class Browser; 25 class Browser;
25 class ChromeRenderMessageFilter; 26 class ChromeRenderMessageFilter;
26 class ExtensionFunction; 27 class ExtensionFunction;
27 class ExtensionFunctionDispatcher; 28 class ExtensionFunctionDispatcher;
28 class UIThreadExtensionFunction; 29 class UIThreadExtensionFunction;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 }; 206 };
206 207
207 // Extension functions that run on the UI thread. Most functions fall into 208 // Extension functions that run on the UI thread. Most functions fall into
208 // this category. 209 // this category.
209 class UIThreadExtensionFunction : public ExtensionFunction { 210 class UIThreadExtensionFunction : public ExtensionFunction {
210 public: 211 public:
211 UIThreadExtensionFunction(); 212 UIThreadExtensionFunction();
212 213
213 virtual UIThreadExtensionFunction* AsUIThreadExtensionFunction() OVERRIDE; 214 virtual UIThreadExtensionFunction* AsUIThreadExtensionFunction() OVERRIDE;
214 215
216 // Called when a message was received.
217 // Should return true if it processed the message.
218 virtual bool OnMessageReceivedFromRenderView(const IPC::Message& message);
219
215 // Set the profile which contains the extension that has originated this 220 // Set the profile which contains the extension that has originated this
216 // function call. 221 // function call.
217 void set_profile(Profile* profile) { profile_ = profile; } 222 void set_profile(Profile* profile) { profile_ = profile; }
218 Profile* profile() const { return profile_; } 223 Profile* profile() const { return profile_; }
219 224
220 void SetRenderViewHost(RenderViewHost* render_view_host); 225 void SetRenderViewHost(RenderViewHost* render_view_host);
221 RenderViewHost* render_view_host() const { return render_view_host_; } 226 RenderViewHost* render_view_host() const { return render_view_host_; }
222 227
223 void set_dispatcher( 228 void set_dispatcher(
224 const base::WeakPtr<ExtensionFunctionDispatcher>& dispatcher) { 229 const base::WeakPtr<ExtensionFunctionDispatcher>& dispatcher) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 public: 280 public:
276 explicit RenderViewHostTracker(UIThreadExtensionFunction* function); 281 explicit RenderViewHostTracker(UIThreadExtensionFunction* function);
277 private: 282 private:
278 virtual void Observe(int type, 283 virtual void Observe(int type,
279 const content::NotificationSource& source, 284 const content::NotificationSource& source,
280 const content::NotificationDetails& details) OVERRIDE; 285 const content::NotificationDetails& details) OVERRIDE;
281 UIThreadExtensionFunction* function_; 286 UIThreadExtensionFunction* function_;
282 content::NotificationRegistrar registrar_; 287 content::NotificationRegistrar registrar_;
283 }; 288 };
284 289
290 class ExtensionRenderViewHostObserver : public RenderViewHostObserver {
Mihai Parparita -not on Chrome 2011/11/15 18:51:42 Does this have to live in ExtensionUIFunction (ins
asargent_no_longer_on_chrome 2011/11/15 18:56:31 We already have the RenderViewHostTracker class de
Jay Civelli 2011/11/18 23:14:32 My case is actually different. The TabContentsObse
Jay Civelli 2011/11/18 23:14:32 Good idea, done.
291 public:
292 ExtensionRenderViewHostObserver(UIThreadExtensionFunction* function,
293 RenderViewHost* render_view_host);
294
295 private:
296 virtual void RenderViewHostDestroyed(
297 RenderViewHost* render_view_host) OVERRIDE;
298 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
299
300 UIThreadExtensionFunction* function_;
301
302 DISALLOW_COPY_AND_ASSIGN(ExtensionRenderViewHostObserver);
303 };
304
285 virtual void Destruct() const; 305 virtual void Destruct() const;
286 306
287 scoped_ptr<RenderViewHostTracker> tracker_; 307 scoped_ptr<RenderViewHostTracker> tracker_;
308 scoped_ptr<ExtensionRenderViewHostObserver> render_view_host_observer_;
288 }; 309 };
289 310
290 // Extension functions that run on the IO thread. This type of function avoids 311 // Extension functions that run on the IO thread. This type of function avoids
291 // a roundtrip to and from the UI thread (because communication with the 312 // a roundtrip to and from the UI thread (because communication with the
292 // extension process happens on the IO thread). It's intended to be used when 313 // extension process happens on the IO thread). It's intended to be used when
293 // performance is critical (e.g. the webRequest API which can block network 314 // performance is critical (e.g. the webRequest API which can block network
294 // requests). Generally, UIThreadExtensionFunction is more appropriate and will 315 // requests). Generally, UIThreadExtensionFunction is more appropriate and will
295 // be easier to use and interface with the rest of the browser. 316 // be easier to use and interface with the rest of the browser.
296 class IOThreadExtensionFunction : public ExtensionFunction { 317 class IOThreadExtensionFunction : public ExtensionFunction {
297 public: 318 public:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 public: 388 public:
368 SyncIOThreadExtensionFunction(); 389 SyncIOThreadExtensionFunction();
369 390
370 virtual void Run() OVERRIDE; 391 virtual void Run() OVERRIDE;
371 392
372 protected: 393 protected:
373 virtual ~SyncIOThreadExtensionFunction(); 394 virtual ~SyncIOThreadExtensionFunction();
374 }; 395 };
375 396
376 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ 397 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_function.cc » ('j') | chrome/browser/extensions/extension_function.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698