summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authoratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-21 01:46:08 +0000
committeratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-21 01:46:08 +0000
commit398206ce0943c935a8da55d382e60e7be16099cf (patch)
treef45ab7ef6f6c101b142a7d5c1393c6455caf2e70 /chrome/browser/extensions
parent0965c6d6d392916a4017bce6ddf5fef8d5bcd22a (diff)
downloadchromium_src-398206ce0943c935a8da55d382e60e7be16099cf.zip
chromium_src-398206ce0943c935a8da55d382e60e7be16099cf.tar.gz
chromium_src-398206ce0943c935a8da55d382e60e7be16099cf.tar.bz2
Added BackgroundContentsService to manage lifecycle of BackgroundContents.
If --restore-background-contents flag is passed, stores the URLs of running BackgroundContents in preferences so they can be re-launched when the browser restarts. Moved logic to shutdown background contents into BackgroundContentsService so we can use this to coordinate when to keep the browser process running. BUG=43382 TEST=new tests Review URL: http://codereview.chromium.org/2104018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50329 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/extensions_ui.cc19
-rw-r--r--chrome/browser/extensions/extensions_ui.h3
2 files changed, 17 insertions, 5 deletions
diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc
index 8c6664b..5cd3711 100644
--- a/chrome/browser/extensions/extensions_ui.cc
+++ b/chrome/browser/extensions/extensions_ui.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
+#include "chrome/browser/tab_contents/background_contents.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/common/chrome_switches.h"
@@ -698,8 +699,13 @@ void ExtensionsDOMHandler::Observe(NotificationType type,
// Doing it this way gets everything but causes the page to be rendered
// more than we need. It doesn't seem to result in any noticeable flicker.
case NotificationType::RENDER_VIEW_HOST_DELETED:
- case NotificationType::BACKGROUND_CONTENTS_DELETED:
deleting_rvh_ = Details<RenderViewHost>(details).ptr();
+ MaybeUpdateAfterNotification();
+ break;
+ case NotificationType::BACKGROUND_CONTENTS_DELETED:
+ deleting_rvh_ = Details<BackgroundContents>(details)->render_view_host();
+ MaybeUpdateAfterNotification();
+ break;
case NotificationType::EXTENSION_LOADED:
case NotificationType::EXTENSION_PROCESS_CREATED:
case NotificationType::EXTENSION_UNLOADED:
@@ -709,16 +715,19 @@ void ExtensionsDOMHandler::Observe(NotificationType type,
case NotificationType::EXTENSION_FUNCTION_DISPATCHER_DESTROYED:
case NotificationType::NAV_ENTRY_COMMITTED:
case NotificationType::BACKGROUND_CONTENTS_NAVIGATED:
- if (!ignore_notifications_ && dom_ui_->tab_contents())
- HandleRequestExtensionsData(NULL);
- deleting_rvh_ = NULL;
+ MaybeUpdateAfterNotification();
break;
-
default:
NOTREACHED();
}
}
+void ExtensionsDOMHandler::MaybeUpdateAfterNotification() {
+ if (!ignore_notifications_ && dom_ui_->tab_contents())
+ HandleRequestExtensionsData(NULL);
+ deleting_rvh_ = NULL;
+}
+
static void CreateScriptFileDetailValue(
const FilePath& extension_path, const UserScript::FileList& scripts,
const wchar_t* key, DictionaryValue* script_data) {
diff --git a/chrome/browser/extensions/extensions_ui.h b/chrome/browser/extensions/extensions_ui.h
index 449c8da..e85e586 100644
--- a/chrome/browser/extensions/extensions_ui.h
+++ b/chrome/browser/extensions/extensions_ui.h
@@ -170,6 +170,9 @@ class ExtensionsDOMHandler
// Callback for "selectFilePath" message.
void HandleSelectFilePathMessage(const Value* value);
+ // Forces a UI update if appropriate after a notification is received.
+ void MaybeUpdateAfterNotification();
+
// SelectFileDialog::Listener
virtual void FileSelected(const FilePath& path,
int index, void* params);