diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/extensions/extension_prefs.cc | 18 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_prefs.h | 6 | ||||
-rw-r--r-- | chrome/browser/extensions/platform_app_launcher.cc | 26 | ||||
-rw-r--r-- | chrome/browser/extensions/shell_window_registry.h | 8 | ||||
-rw-r--r-- | chrome/browser/ui/extensions/shell_window.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/extensions/shell_window.h | 1 |
6 files changed, 8 insertions, 55 deletions
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 32736a9..a200bfc 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -51,9 +51,6 @@ namespace { // Whether this extension was running when chrome last shutdown. const char kPrefRunning[] = "running"; -// Whether this extension had windows when it was last running. -const char kHasWindows[] = "has_windows"; - // Where an extension was installed from. (see Manifest::Location) const char kPrefLocation[] = "location"; @@ -1149,21 +1146,6 @@ bool ExtensionPrefs::IsExtensionRunning(const std::string& extension_id) { return running; } -void ExtensionPrefs::SetHasWindows(const std::string& extension_id, - bool has_windows) { - Value* value = Value::CreateBooleanValue(has_windows); - UpdateExtensionPref(extension_id, kHasWindows, value); -} - -bool ExtensionPrefs::HasWindows(const std::string& extension_id) { - const DictionaryValue* extension = GetExtensionPref(extension_id); - if (!extension) - return false; - bool has_windows = false; - extension->GetBoolean(kHasWindows, &has_windows); - return has_windows; -} - bool ExtensionPrefs::IsIncognitoEnabled(const std::string& extension_id) { return ReadPrefAsBooleanAndReturn(extension_id, kPrefIncognitoEnabled); } diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h index c8c648c..68870da 100644 --- a/chrome/browser/extensions/extension_prefs.h +++ b/chrome/browser/extensions/extension_prefs.h @@ -363,12 +363,6 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, // restart apps across browser restarts. bool IsExtensionRunning(const std::string& extension_id); - // Set/Get whether or not the extension has windows associated with it. Used - // to force a launch of apps that don't handle onRestarted() on a restart. We - // can only safely do that if the app had windows when it was last running. - void SetHasWindows(const std::string& extension_id, bool has_windows); - bool HasWindows(const std::string& extension_id); - // Returns true if the user enabled this extension to be loaded in incognito // mode. bool IsIncognitoEnabled(const std::string& extension_id); diff --git a/chrome/browser/extensions/platform_app_launcher.cc b/chrome/browser/extensions/platform_app_launcher.cc index e4e630c..34ee359 100644 --- a/chrome/browser/extensions/platform_app_launcher.cc +++ b/chrome/browser/extensions/platform_app_launcher.cc @@ -14,8 +14,6 @@ #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" #include "chrome/browser/extensions/api/file_system/file_system_api.h" -#include "chrome/browser/extensions/event_names.h" -#include "chrome/browser/extensions/event_router.h" #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/extensions/extension_prefs.h" #include "chrome/browser/extensions/extension_process_manager.h" @@ -423,27 +421,9 @@ void RestartPlatformAppWithFileEntries( Profile* profile, const Extension* extension, const std::vector<SavedFileEntry>& file_entries) { - extensions::EventRouter* event_router = - ExtensionSystem::Get(profile)->event_router(); - bool listening_to_restart = event_router-> - ExtensionHasEventListener(extension->id(), event_names::kOnRestarted); - - if (listening_to_restart) { - scoped_refptr<SavedFileEntryLauncher> launcher = new SavedFileEntryLauncher( - profile, extension, file_entries); - launcher->Launch(); - return; - } - - ExtensionPrefs* extension_prefs = ExtensionSystem::Get(profile)-> - extension_service()->extension_prefs(); - bool had_windows = extension_prefs->HasWindows(extension->id()); - extension_prefs->SetHasWindows(extension->id(), false); - bool listening_to_launch = event_router-> - ExtensionHasEventListener(extension->id(), event_names::kOnLaunched); - - if (listening_to_launch && had_windows) - LaunchPlatformAppWithNoData(profile, extension); + scoped_refptr<SavedFileEntryLauncher> launcher = new SavedFileEntryLauncher( + profile, extension, file_entries); + launcher->Launch(); } } // namespace extensions diff --git a/chrome/browser/extensions/shell_window_registry.h b/chrome/browser/extensions/shell_window_registry.h index dca2105..062b2ad 100644 --- a/chrome/browser/extensions/shell_window_registry.h +++ b/chrome/browser/extensions/shell_window_registry.h @@ -98,6 +98,10 @@ class ShellWindowRegistry : public ProfileKeyedService { // ShellWindow::WindowType, or 0 for any window type. static bool IsShellWindowRegisteredInAnyProfile(int window_type_mask); + protected: + void OnDevToolsStateChanged(content::DevToolsAgentHost*, bool attached); + + private: class Factory : public ProfileKeyedServiceFactory { public: static ShellWindowRegistry* GetForProfile(Profile* profile, bool create); @@ -118,10 +122,6 @@ class ShellWindowRegistry : public ProfileKeyedService { content::BrowserContext* context) const OVERRIDE; }; - protected: - void OnDevToolsStateChanged(content::DevToolsAgentHost*, bool attached); - - private: Profile* profile_; ShellWindowSet shell_windows_; InspectedWindowSet inspected_windows_; diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc index f9a06cd..f167e74 100644 --- a/chrome/browser/ui/extensions/shell_window.cc +++ b/chrome/browser/ui/extensions/shell_window.cc @@ -530,10 +530,8 @@ void ShellWindow::Observe(int type, const extensions::Extension* unloaded_extension = content::Details<extensions::UnloadedExtensionInfo>( details)->extension; - if (extension_ == unloaded_extension) { + if (extension_ == unloaded_extension) native_app_window_->Close(); - extension_ = NULL; - } break; } case chrome::NOTIFICATION_APP_TERMINATING: diff --git a/chrome/browser/ui/extensions/shell_window.h b/chrome/browser/ui/extensions/shell_window.h index fee67a5..05b06ab 100644 --- a/chrome/browser/ui/extensions/shell_window.h +++ b/chrome/browser/ui/extensions/shell_window.h @@ -274,7 +274,6 @@ class ShellWindow : public content::NotificationObserver, Profile* profile_; // weak pointer - owned by ProfileManager. // weak pointer - owned by ExtensionService. - // This gets set to NULL when the extension is uninstalled. const extensions::Extension* extension_; // Identifier that is used when saving and restoring geometry for this |