OLD | NEW |
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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "chrome/browser/extensions/extension_event_router.h" | 12 #include "chrome/browser/extensions/extension_event_router.h" |
13 #include "chrome/browser/extensions/extension_process_manager.h" | 13 #include "chrome/browser/extensions/extension_process_manager.h" |
14 #include "chrome/browser/extensions/extension_host.h" | 14 #include "chrome/browser/extensions/extension_host.h" |
15 #include "chrome/browser/extensions/extension_info_map.h" | 15 #include "chrome/browser/extensions/extension_info_map.h" |
16 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/extensions/extension_system.h" | 17 #include "chrome/browser/extensions/extension_system.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/browser_finder.h" |
20 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
21 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/common/chrome_view_type.h" | 24 #include "chrome/common/chrome_view_type.h" |
24 #include "chrome/common/extensions/extension.h" | 25 #include "chrome/common/extensions/extension.h" |
25 #include "chrome/common/extensions/extension_messages.h" | 26 #include "chrome/common/extensions/extension_messages.h" |
26 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/render_process_host.h" | 30 #include "content/public/browser/render_process_host.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 278 } |
278 | 279 |
279 void ExtensionProcessManager::OpenOptionsPage(const Extension* extension, | 280 void ExtensionProcessManager::OpenOptionsPage(const Extension* extension, |
280 Browser* browser) { | 281 Browser* browser) { |
281 DCHECK(!extension->options_url().is_empty()); | 282 DCHECK(!extension->options_url().is_empty()); |
282 | 283 |
283 // Force the options page to open in non-OTR window, because it won't be | 284 // Force the options page to open in non-OTR window, because it won't be |
284 // able to save settings from OTR. | 285 // able to save settings from OTR. |
285 if (!browser || browser->profile()->IsOffTheRecord()) { | 286 if (!browser || browser->profile()->IsOffTheRecord()) { |
286 Profile* profile = GetProfile(); | 287 Profile* profile = GetProfile(); |
287 browser = Browser::GetOrCreateTabbedBrowser(profile->GetOriginalProfile()); | 288 browser = browser::FindOrCreateTabbedBrowser(profile->GetOriginalProfile()); |
288 } | 289 } |
289 | 290 |
290 OpenURLParams params(extension->options_url(), Referrer(), SINGLETON_TAB, | 291 OpenURLParams params(extension->options_url(), Referrer(), SINGLETON_TAB, |
291 content::PAGE_TRANSITION_LINK, false); | 292 content::PAGE_TRANSITION_LINK, false); |
292 browser->OpenURL(params); | 293 browser->OpenURL(params); |
293 browser->window()->Show(); | 294 browser->window()->Show(); |
294 browser->GetSelectedWebContents()->GetRenderViewHost()->GetDelegate()-> | 295 browser->GetSelectedWebContents()->GetRenderViewHost()->GetDelegate()-> |
295 Activate(); | 296 Activate(); |
296 } | 297 } |
297 | 298 |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 if (service && service->is_ready()) | 766 if (service && service->is_ready()) |
766 CreateBackgroundHostsForProfileStartup(this, service->extensions()); | 767 CreateBackgroundHostsForProfileStartup(this, service->extensions()); |
767 } | 768 } |
768 break; | 769 break; |
769 } | 770 } |
770 default: | 771 default: |
771 ExtensionProcessManager::Observe(type, source, details); | 772 ExtensionProcessManager::Observe(type, source, details); |
772 break; | 773 break; |
773 } | 774 } |
774 } | 775 } |
OLD | NEW |