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

Side by Side Diff: chrome/browser/extensions/extension_process_manager.cc

Issue 11742005: Move [Homepage,Options,Update,DevTools]URL out of Extension (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: Created 7 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "chrome/browser/extensions/api/runtime/runtime_api.h" 14 #include "chrome/browser/extensions/api/runtime/runtime_api.h"
15 #include "chrome/browser/extensions/extension_process_manager.h" 15 #include "chrome/browser/extensions/extension_process_manager.h"
16 #include "chrome/browser/extensions/extension_host.h" 16 #include "chrome/browser/extensions/extension_host.h"
17 #include "chrome/browser/extensions/extension_info_map.h" 17 #include "chrome/browser/extensions/extension_info_map.h"
18 #include "chrome/browser/extensions/extension_service.h" 18 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/extensions/extension_system.h" 19 #include "chrome/browser/extensions/extension_system.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_finder.h" 22 #include "chrome/browser/ui/browser_finder.h"
23 #include "chrome/browser/ui/browser_tabstrip.h" 23 #include "chrome/browser/ui/browser_tabstrip.h"
24 #include "chrome/browser/ui/browser_window.h" 24 #include "chrome/browser/ui/browser_window.h"
25 #include "chrome/browser/view_type_utils.h" 25 #include "chrome/browser/view_type_utils.h"
26 #include "chrome/common/chrome_notification_types.h" 26 #include "chrome/common/chrome_notification_types.h"
27 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
28 #include "chrome/common/extensions/api/extension_urls/extension_urls_handler.h"
28 #include "chrome/common/extensions/extension.h" 29 #include "chrome/common/extensions/extension.h"
29 #include "chrome/common/extensions/extension_messages.h" 30 #include "chrome/common/extensions/extension_messages.h"
30 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
31 #include "content/public/browser/browser_thread.h" 32 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/notification_service.h" 33 #include "content/public/browser/notification_service.h"
33 #include "content/public/browser/render_process_host.h" 34 #include "content/public/browser/render_process_host.h"
34 #include "content/public/browser/render_view_host.h" 35 #include "content/public/browser/render_view_host.h"
35 #include "content/public/browser/site_instance.h" 36 #include "content/public/browser/site_instance.h"
36 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
37 #include "content/public/browser/web_contents_delegate.h" 38 #include "content/public/browser/web_contents_delegate.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 new ExtensionHost(extension, GetSiteInstanceForURL(url), url, 304 new ExtensionHost(extension, GetSiteInstanceForURL(url), url,
304 chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); 305 chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE);
305 #endif 306 #endif
306 307
307 host->CreateRenderViewSoon(); 308 host->CreateRenderViewSoon();
308 OnExtensionHostCreated(host, true); 309 OnExtensionHostCreated(host, true);
309 } 310 }
310 311
311 void ExtensionProcessManager::OpenOptionsPage(const Extension* extension, 312 void ExtensionProcessManager::OpenOptionsPage(const Extension* extension,
312 Browser* browser) { 313 Browser* browser) {
313 DCHECK(!extension->options_url().is_empty()); 314 DCHECK(!extensions::ExtensionURL::GetOptionsURL(extension).is_empty());
314 315
315 // Force the options page to open in non-OTR window, because it won't be 316 // Force the options page to open in non-OTR window, because it won't be
316 // able to save settings from OTR. 317 // able to save settings from OTR.
317 if (browser->profile()->IsOffTheRecord()) { 318 if (browser->profile()->IsOffTheRecord()) {
318 Profile* profile = GetProfile(); 319 Profile* profile = GetProfile();
319 browser = chrome::FindOrCreateTabbedBrowser(profile->GetOriginalProfile(), 320 browser = chrome::FindOrCreateTabbedBrowser(profile->GetOriginalProfile(),
320 browser->host_desktop_type()); 321 browser->host_desktop_type());
321 } 322 }
322 323
323 OpenURLParams params(extension->options_url(), Referrer(), SINGLETON_TAB, 324 OpenURLParams params(extensions::ExtensionURL::GetOptionsURL(extension),
324 content::PAGE_TRANSITION_LINK, false); 325 Referrer(),
326 SINGLETON_TAB,
327 content::PAGE_TRANSITION_LINK,
328 false);
325 browser->OpenURL(params); 329 browser->OpenURL(params);
326 browser->window()->Show(); 330 browser->window()->Show();
327 WebContents* web_contents = chrome::GetActiveWebContents(browser); 331 WebContents* web_contents = chrome::GetActiveWebContents(browser);
328 web_contents->GetDelegate()->ActivateContents(web_contents); 332 web_contents->GetDelegate()->ActivateContents(web_contents);
329 } 333 }
330 334
331 ExtensionHost* ExtensionProcessManager::GetBackgroundHostForExtension( 335 ExtensionHost* ExtensionProcessManager::GetBackgroundHostForExtension(
332 const std::string& extension_id) { 336 const std::string& extension_id) {
333 for (ExtensionHostSet::iterator iter = background_hosts_.begin(); 337 for (ExtensionHostSet::iterator iter = background_hosts_.begin();
334 iter != background_hosts_.end(); ++iter) { 338 iter != background_hosts_.end(); ++iter) {
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 CreateBackgroundHostsForProfileStartup(GetProfile(), 857 CreateBackgroundHostsForProfileStartup(GetProfile(),
854 this, service->extensions()); 858 this, service->extensions());
855 } 859 }
856 break; 860 break;
857 } 861 }
858 default: 862 default:
859 ExtensionProcessManager::Observe(type, source, details); 863 ExtensionProcessManager::Observe(type, source, details);
860 break; 864 break;
861 } 865 }
862 } 866 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_context_menu_model.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698