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

Unified 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: Addressed sky's comments. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_function.h
diff --git a/chrome/browser/extensions/extension_function.h b/chrome/browser/extensions/extension_function.h
index 4b1fb5fb34d40fd6b76d88d5febb7f243400d0a9..c6fd6e24424ffeabd55302e25ee2eeb0c087a80a 100644
--- a/chrome/browser/extensions/extension_function.h
+++ b/chrome/browser/extensions/extension_function.h
@@ -16,6 +16,7 @@
#include "base/process.h"
#include "chrome/browser/extensions/extension_info_map.h"
#include "chrome/common/extensions/extension.h"
+#include "content/browser/renderer_host/render_view_host_observer.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -212,6 +213,10 @@ class UIThreadExtensionFunction : public ExtensionFunction {
virtual UIThreadExtensionFunction* AsUIThreadExtensionFunction() OVERRIDE;
+ // Called when a message was received.
+ // Should return true if it processed the message.
+ virtual bool OnMessageReceivedFromRenderView(const IPC::Message& message);
+
// Set the profile which contains the extension that has originated this
// function call.
void set_profile(Profile* profile) { profile_ = profile; }
@@ -266,20 +271,30 @@ class UIThreadExtensionFunction : public ExtensionFunction {
private:
// Helper class to track the lifetime of ExtensionFunction's RenderViewHost
- // pointer and NULL it out when it dies. We use this separate class (instead
- // of implementing NotificationObserver on ExtensionFunction) because it is
- // common for subclasses of ExtensionFunction to be NotificationObservers, and
- // it would be an easy error to forget to call the base class's Observe()
- // method.
- class RenderViewHostTracker : public content::NotificationObserver {
+ // pointer and NULL it out when it dies. It also allows us to filter IPC
+ // messages comming from the RenderViewHost. We use this separate class
+ // (instead of implementing NotificationObserver on ExtensionFunction) because
+ // it is/ common for subclasses of ExtensionFunction to be
+ // NotificationObservers, and it would be an easy error to forget to call the
+ // base class's Observe() method.
+ class RenderViewHostTracker : public content::NotificationObserver,
+ public RenderViewHostObserver {
public:
- explicit RenderViewHostTracker(UIThreadExtensionFunction* function);
+ RenderViewHostTracker(UIThreadExtensionFunction* function,
+ RenderViewHost* render_view_host);
private:
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+
+ virtual void RenderViewHostDestroyed(
+ RenderViewHost* render_view_host) OVERRIDE;
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+
UIThreadExtensionFunction* function_;
content::NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(RenderViewHostTracker);
};
virtual void Destruct() const;
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_function.cc » ('j') | chrome/browser/extensions/extension_save_page_api.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698