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

Unified Diff: chrome/browser/ui/extensions/shell_window.cc

Issue 10119003: Pull shell window stuff out of ExtensionHost and put in ShellWindow (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: More stuff Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/extensions/shell_window.cc
diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc
index f624f95f2636ad32e41dbe970f8f3d201304b42c..301e7354ca26c8ff4f4ffe0e55d6a9417cb280a4 100644
--- a/chrome/browser/ui/extensions/shell_window.cc
+++ b/chrome/browser/ui/extensions/shell_window.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/extensions/extension_tabs_module_constants.h"
#include "chrome/browser/extensions/extension_window_controller.h"
+#include "chrome/browser/extensions/platform_app_host.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_id.h"
#include "chrome/common/chrome_notification_types.h"
@@ -84,23 +85,22 @@ ShellWindow* ShellWindow::Create(Profile* profile,
// This object will delete itself when the window is closed.
return ShellWindow::CreateShellWindow(
- manager->CreateShellHost(extension, url));
+ new PlatformAppHost(profile, url), extension);
}
void ShellWindow::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE:
- if (content::Details<ExtensionHost>(host_.get()) == details)
- Close();
- break;
+ // TODO(benwells): Use new PLATFORM_HOST_VIEW_SHOULD_CLOSE
+ // case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE:
+ // if (content::Details<ExtensionHost>(host_.get()) == details)
+ // Close();
+ // break;
case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
const Extension* unloaded_extension =
content::Details<UnloadedExtensionInfo>(details)->extension;
- // We compare extension IDs and not Extension pointers since ExtensionHost
- // nulls out its Extension pointer when it gets this notification.
- if (host_->extension_id() == unloaded_extension->id())
+ if (extension_ == unloaded_extension)
Close();
break;
}
@@ -112,8 +112,9 @@ void ShellWindow::Observe(int type,
}
}
-ShellWindow::ShellWindow(ExtensionHost* host)
- : host_(host) {
+ShellWindow::ShellWindow(PlatformAppHost* host, const Extension* extension)
+ : host_(host),
+ extension_(extension) {
// Close the window in response to window.close() and the like.
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
content::Source<Profile>(host->profile()));

Powered by Google App Engine
This is Rietveld 408576698