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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 7448012: Create the correct SiteInstance when restoring tabs that belong to apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix style. Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/tab_contents/tab_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/app/breakpad_mac.h" 8 #include "chrome/app/breakpad_mac.h"
9 #include "chrome/browser/browser_about_handler.h" 9 #include "chrome/browser/browser_about_handler.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "chrome/browser/ui/crypto_module_password_dialog.h" 76 #include "chrome/browser/ui/crypto_module_password_dialog.h"
77 #endif 77 #endif
78 78
79 namespace { 79 namespace {
80 80
81 void InitRenderViewHostForExtensions(RenderViewHost* render_view_host) { 81 void InitRenderViewHostForExtensions(RenderViewHost* render_view_host) {
82 // Note that due to GetEffectiveURL(), even hosted apps will have a 82 // Note that due to GetEffectiveURL(), even hosted apps will have a
83 // chrome-extension:// URL for their site, so we can ignore that wrinkle here. 83 // chrome-extension:// URL for their site, so we can ignore that wrinkle here.
84 SiteInstance* site_instance = render_view_host->site_instance(); 84 SiteInstance* site_instance = render_view_host->site_instance();
85 const GURL& site = site_instance->site(); 85 const GURL& site = site_instance->site();
86 RenderProcessHost* process = render_view_host->process();
87 86
88 if (!site.SchemeIs(chrome::kExtensionScheme)) 87 if (!site.SchemeIs(chrome::kExtensionScheme))
89 return; 88 return;
90 89
91 Profile* profile = site_instance->browsing_instance()->profile(); 90 Profile* profile = site_instance->browsing_instance()->profile();
92 ExtensionService* service = profile->GetExtensionService(); 91 ExtensionService* service = profile->GetExtensionService();
93 if (!service) 92 if (!service)
94 return; 93 return;
95 94
96 ExtensionProcessManager* process_manager = 95 ExtensionProcessManager* process_manager =
97 profile->GetExtensionProcessManager(); 96 profile->GetExtensionProcessManager();
98 CHECK(process_manager); 97 CHECK(process_manager);
99 98
100 // This can happen if somebody typos a chrome-extension:// URL. 99 // This can happen if somebody typos a chrome-extension:// URL.
101 const Extension* extension = service->GetExtensionByURL(site); 100 const Extension* extension = service->GetExtensionByURL(site);
102 if (!extension) 101 if (!extension)
103 return; 102 return;
104 103
105 site_instance->GetProcess()->mark_is_extension_process(); 104 site_instance->GetProcess()->mark_is_extension_process();
106 105
107 // Register the association between extension and SiteInstance with 106 // Register the association between extension and SiteInstance with
108 // ExtensionProcessManager. 107 // ExtensionProcessManager.
109 // TODO(creis): Use this to replace SetInstalledAppForRenderer below. 108 // TODO(creis): Use this to replace SetInstalledAppForRenderer below.
110 process_manager->RegisterExtensionSiteInstance(site_instance->id(), 109 process_manager->RegisterExtensionSiteInstance(site_instance->id(),
111 extension->id()); 110 extension->id());
112 111
112 RenderProcessHost* process = render_view_host->process();
113
113 if (extension->is_app()) { 114 if (extension->is_app()) {
114 render_view_host->Send( 115 render_view_host->Send(
115 new ExtensionMsg_ActivateApplication(extension->id())); 116 new ExtensionMsg_ActivateApplication(extension->id()));
116 // Record which, if any, installed app is associated with this process. 117 // Record which, if any, installed app is associated with this process.
117 // TODO(aa): Totally lame to store this state in a global map in extension 118 // TODO(aa): Totally lame to store this state in a global map in extension
118 // service. Can we get it from EPM instead? 119 // service. Can we get it from EPM instead?
119 service->SetInstalledAppForRenderer(process->id(), extension); 120 service->SetInstalledAppForRenderer(process->id(), extension);
120 } 121 }
121 122
122 // Some extensions use chrome:// URLs. 123 // Some extensions use chrome:// URLs.
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 #if defined(USE_NSS) 758 #if defined(USE_NSS)
758 crypto::CryptoModuleBlockingPasswordDelegate* 759 crypto::CryptoModuleBlockingPasswordDelegate*
759 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 760 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
760 const GURL& url) { 761 const GURL& url) {
761 return browser::NewCryptoModuleBlockingDialogDelegate( 762 return browser::NewCryptoModuleBlockingDialogDelegate(
762 browser::kCryptoModulePasswordKeygen, url.host()); 763 browser::kCryptoModulePasswordKeygen, url.host());
763 } 764 }
764 #endif 765 #endif
765 766
766 } // namespace chrome 767 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/tab_contents/tab_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698