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

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

Issue 11365181: Remove GetExtensionService from Profile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: response to sky Created 8 years, 1 month 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "chrome/browser/download/download_crx_util.h" 46 #include "chrome/browser/download/download_crx_util.h"
47 #include "chrome/browser/download/download_item_model.h" 47 #include "chrome/browser/download/download_item_model.h"
48 #include "chrome/browser/download/download_service.h" 48 #include "chrome/browser/download/download_service.h"
49 #include "chrome/browser/download/download_service_factory.h" 49 #include "chrome/browser/download/download_service_factory.h"
50 #include "chrome/browser/download/download_shelf.h" 50 #include "chrome/browser/download/download_shelf.h"
51 #include "chrome/browser/download/download_started_animation.h" 51 #include "chrome/browser/download/download_started_animation.h"
52 #include "chrome/browser/download/download_util.h" 52 #include "chrome/browser/download/download_util.h"
53 #include "chrome/browser/extensions/browser_extension_window_controller.h" 53 #include "chrome/browser/extensions/browser_extension_window_controller.h"
54 #include "chrome/browser/extensions/extension_prefs.h" 54 #include "chrome/browser/extensions/extension_prefs.h"
55 #include "chrome/browser/extensions/extension_service.h" 55 #include "chrome/browser/extensions/extension_service.h"
56 #include "chrome/browser/extensions/extension_system.h"
56 #include "chrome/browser/extensions/tab_helper.h" 57 #include "chrome/browser/extensions/tab_helper.h"
57 #include "chrome/browser/favicon/favicon_tab_helper.h" 58 #include "chrome/browser/favicon/favicon_tab_helper.h"
58 #include "chrome/browser/file_select_helper.h" 59 #include "chrome/browser/file_select_helper.h"
59 #include "chrome/browser/first_run/first_run.h" 60 #include "chrome/browser/first_run/first_run.h"
60 #include "chrome/browser/google/google_url_tracker.h" 61 #include "chrome/browser/google/google_url_tracker.h"
61 #include "chrome/browser/infobars/infobar_tab_helper.h" 62 #include "chrome/browser/infobars/infobar_tab_helper.h"
62 #include "chrome/browser/intents/device_attached_intent_source.h" 63 #include "chrome/browser/intents/device_attached_intent_source.h"
63 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" 64 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h"
64 #include "chrome/browser/intents/web_intents_reporting.h" 65 #include "chrome/browser/intents/web_intents_reporting.h"
65 #include "chrome/browser/intents/web_intents_util.h" 66 #include "chrome/browser/intents/web_intents_util.h"
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 delete intents_dispatcher; 1672 delete intents_dispatcher;
1672 return; 1673 return;
1673 } 1674 }
1674 1675
1675 // Make sure the requester is coming from an extension/app page. 1676 // Make sure the requester is coming from an extension/app page.
1676 // Internal dispatches set |web_contents| to NULL. 1677 // Internal dispatches set |web_contents| to NULL.
1677 #if !defined(OS_CHROMEOS) 1678 #if !defined(OS_CHROMEOS)
1678 if (web_contents && 1679 if (web_contents &&
1679 !CommandLine::ForCurrentProcess()->HasSwitch( 1680 !CommandLine::ForCurrentProcess()->HasSwitch(
1680 switches::kWebIntentsInvocationEnabled)) { 1681 switches::kWebIntentsInvocationEnabled)) {
1681 ExtensionService* extensions_service = profile_->GetExtensionService(); 1682 ExtensionService* extensions_service =
1683 extensions::ExtensionSystem::Get(profile_)->extension_service();
1682 if (!extensions_service || 1684 if (!extensions_service ||
1683 extensions_service->extensions()->GetExtensionOrAppByURL( 1685 extensions_service->extensions()->GetExtensionOrAppByURL(
1684 ExtensionURLInfo(web_contents->GetURL())) == NULL) { 1686 ExtensionURLInfo(web_contents->GetURL())) == NULL) {
1685 web_intents::RecordIntentsDispatchDisabled(); 1687 web_intents::RecordIntentsDispatchDisabled();
1686 intents_dispatcher->SendReplyMessage( 1688 intents_dispatcher->SendReplyMessage(
1687 webkit_glue::WEB_INTENT_REPLY_FAILURE, 1689 webkit_glue::WEB_INTENT_REPLY_FAILURE,
1688 ASCIIToUTF16("Intents may only be invoked from extensions/apps.")); 1690 ASCIIToUTF16("Intents may only be invoked from extensions/apps."));
1689 return; 1691 return;
1690 } 1692 }
1691 } 1693 }
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 BookmarkBar::ANIMATE_STATE_CHANGE : 2280 BookmarkBar::ANIMATE_STATE_CHANGE :
2279 BookmarkBar::DONT_ANIMATE_STATE_CHANGE; 2281 BookmarkBar::DONT_ANIMATE_STATE_CHANGE;
2280 window_->BookmarkBarStateChanged(animate_type); 2282 window_->BookmarkBarStateChanged(animate_type);
2281 } 2283 }
2282 2284
2283 bool Browser::MaybeCreateBackgroundContents(int route_id, 2285 bool Browser::MaybeCreateBackgroundContents(int route_id,
2284 WebContents* opener_web_contents, 2286 WebContents* opener_web_contents,
2285 const string16& frame_name, 2287 const string16& frame_name,
2286 const GURL& target_url) { 2288 const GURL& target_url) {
2287 GURL opener_url = opener_web_contents->GetURL(); 2289 GURL opener_url = opener_web_contents->GetURL();
2288 ExtensionService* extensions_service = profile_->GetExtensionService(); 2290 ExtensionService* extensions_service =
2291 extensions::ExtensionSystem::Get(profile_)->extension_service();
2289 2292
2290 if (!opener_url.is_valid() || 2293 if (!opener_url.is_valid() ||
2291 frame_name.empty() || 2294 frame_name.empty() ||
2292 !extensions_service || 2295 !extensions_service ||
2293 !extensions_service->is_ready()) 2296 !extensions_service->is_ready())
2294 return false; 2297 return false;
2295 2298
2296 // Only hosted apps have web extents, so this ensures that only hosted apps 2299 // Only hosted apps have web extents, so this ensures that only hosted apps
2297 // can create BackgroundContents. We don't have to check for background 2300 // can create BackgroundContents. We don't have to check for background
2298 // permission as that is checked in RenderMessageFilter when the CreateWindow 2301 // permission as that is checked in RenderMessageFilter when the CreateWindow
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 if (contents && !allow_js_access) { 2356 if (contents && !allow_js_access) {
2354 contents->web_contents()->GetController().LoadURL( 2357 contents->web_contents()->GetController().LoadURL(
2355 target_url, 2358 target_url,
2356 content::Referrer(), 2359 content::Referrer(),
2357 content::PAGE_TRANSITION_LINK, 2360 content::PAGE_TRANSITION_LINK,
2358 std::string()); // No extra headers. 2361 std::string()); // No extra headers.
2359 } 2362 }
2360 2363
2361 return contents != NULL; 2364 return contents != NULL;
2362 } 2365 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698