diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-10 20:30:10 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-10 20:30:10 +0000 |
commit | fca656cb7bd5737a18c809d8f44edc6a99e6bb9a (patch) | |
tree | 477a3061a64a4f845642c7de780864214201e3f0 /chrome/browser/browser.cc | |
parent | 381f69ad5478d24e5bbb448727c05379204c87d3 (diff) | |
download | chromium_src-fca656cb7bd5737a18c809d8f44edc6a99e6bb9a.zip chromium_src-fca656cb7bd5737a18c809d8f44edc6a99e6bb9a.tar.gz chromium_src-fca656cb7bd5737a18c809d8f44edc6a99e6bb9a.tar.bz2 |
Adds code to restore application extensions. I'm also enabling tab
pinning on views again as everything in place, except a couple of
bugs.
BUG=32845
TEST=none
Review URL: http://codereview.chromium.org/598027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38657 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 2e6e0d0..0de4558 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -671,11 +671,13 @@ TabContents* Browser::AddRestoredTab( const std::vector<TabNavigation>& navigations, int tab_index, int selected_navigation, + const std::string& app_extension_id, bool select, bool pin, bool from_last_session) { TabContents* new_tab = new TabContents(profile(), NULL, MSG_ROUTING_NONE, tabstrip_model_.GetSelectedTabContents()); + SetAppExtensionById(new_tab, app_extension_id); new_tab->controller().RestoreFromState(navigations, selected_navigation, from_last_session); @@ -697,9 +699,11 @@ TabContents* Browser::AddRestoredTab( void Browser::ReplaceRestoredTab( const std::vector<TabNavigation>& navigations, int selected_navigation, - bool from_last_session) { + bool from_last_session, + const std::string& app_extension_id) { TabContents* replacement = new TabContents(profile(), NULL, MSG_ROUTING_NONE, tabstrip_model_.GetSelectedTabContents()); + SetAppExtensionById(replacement, app_extension_id); replacement->controller().RestoreFromState(navigations, selected_navigation, from_last_session); @@ -3262,3 +3266,18 @@ bool Browser::RunUnloadEventsHelper(TabContents* contents) { } return false; } + +void Browser::SetAppExtensionById(TabContents* contents, + const std::string& app_extension_id) { + if (app_extension_id.empty()) + return; + + ExtensionsService* extension_service = profile()->GetExtensionsService(); + if (extension_service && extension_service->is_ready()) { + Extension* extension = + extension_service->GetExtensionById(app_extension_id, false); + if (extension) + contents->SetAppExtension(extension); + } +} + |