OLD | NEW |
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 Loading... |
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 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 delete intents_dispatcher; | 1697 delete intents_dispatcher; |
1697 return; | 1698 return; |
1698 } | 1699 } |
1699 | 1700 |
1700 // Make sure the requester is coming from an extension/app page. | 1701 // Make sure the requester is coming from an extension/app page. |
1701 // Internal dispatches set |web_contents| to NULL. | 1702 // Internal dispatches set |web_contents| to NULL. |
1702 #if !defined(OS_CHROMEOS) | 1703 #if !defined(OS_CHROMEOS) |
1703 if (web_contents && | 1704 if (web_contents && |
1704 !CommandLine::ForCurrentProcess()->HasSwitch( | 1705 !CommandLine::ForCurrentProcess()->HasSwitch( |
1705 switches::kWebIntentsInvocationEnabled)) { | 1706 switches::kWebIntentsInvocationEnabled)) { |
1706 ExtensionService* extensions_service = profile_->GetExtensionService(); | 1707 ExtensionService* extensions_service = |
| 1708 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
1707 if (!extensions_service || | 1709 if (!extensions_service || |
1708 extensions_service->extensions()->GetExtensionOrAppByURL( | 1710 extensions_service->extensions()->GetExtensionOrAppByURL( |
1709 ExtensionURLInfo(web_contents->GetURL())) == NULL) { | 1711 ExtensionURLInfo(web_contents->GetURL())) == NULL) { |
1710 web_intents::RecordIntentsDispatchDisabled(); | 1712 web_intents::RecordIntentsDispatchDisabled(); |
1711 intents_dispatcher->SendReplyMessage( | 1713 intents_dispatcher->SendReplyMessage( |
1712 webkit_glue::WEB_INTENT_REPLY_FAILURE, | 1714 webkit_glue::WEB_INTENT_REPLY_FAILURE, |
1713 ASCIIToUTF16("Intents may only be invoked from extensions/apps.")); | 1715 ASCIIToUTF16("Intents may only be invoked from extensions/apps.")); |
1714 return; | 1716 return; |
1715 } | 1717 } |
1716 } | 1718 } |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2337 BookmarkBar::ANIMATE_STATE_CHANGE : | 2339 BookmarkBar::ANIMATE_STATE_CHANGE : |
2338 BookmarkBar::DONT_ANIMATE_STATE_CHANGE; | 2340 BookmarkBar::DONT_ANIMATE_STATE_CHANGE; |
2339 window_->BookmarkBarStateChanged(animate_type); | 2341 window_->BookmarkBarStateChanged(animate_type); |
2340 } | 2342 } |
2341 | 2343 |
2342 bool Browser::MaybeCreateBackgroundContents(int route_id, | 2344 bool Browser::MaybeCreateBackgroundContents(int route_id, |
2343 WebContents* opener_web_contents, | 2345 WebContents* opener_web_contents, |
2344 const string16& frame_name, | 2346 const string16& frame_name, |
2345 const GURL& target_url) { | 2347 const GURL& target_url) { |
2346 GURL opener_url = opener_web_contents->GetURL(); | 2348 GURL opener_url = opener_web_contents->GetURL(); |
2347 ExtensionService* extensions_service = profile_->GetExtensionService(); | 2349 ExtensionService* extensions_service = |
| 2350 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
2348 | 2351 |
2349 if (!opener_url.is_valid() || | 2352 if (!opener_url.is_valid() || |
2350 frame_name.empty() || | 2353 frame_name.empty() || |
2351 !extensions_service || | 2354 !extensions_service || |
2352 !extensions_service->is_ready()) | 2355 !extensions_service->is_ready()) |
2353 return false; | 2356 return false; |
2354 | 2357 |
2355 // Only hosted apps have web extents, so this ensures that only hosted apps | 2358 // Only hosted apps have web extents, so this ensures that only hosted apps |
2356 // can create BackgroundContents. We don't have to check for background | 2359 // can create BackgroundContents. We don't have to check for background |
2357 // permission as that is checked in RenderMessageFilter when the CreateWindow | 2360 // permission as that is checked in RenderMessageFilter when the CreateWindow |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2412 if (contents && !allow_js_access) { | 2415 if (contents && !allow_js_access) { |
2413 contents->web_contents()->GetController().LoadURL( | 2416 contents->web_contents()->GetController().LoadURL( |
2414 target_url, | 2417 target_url, |
2415 content::Referrer(), | 2418 content::Referrer(), |
2416 content::PAGE_TRANSITION_LINK, | 2419 content::PAGE_TRANSITION_LINK, |
2417 std::string()); // No extra headers. | 2420 std::string()); // No extra headers. |
2418 } | 2421 } |
2419 | 2422 |
2420 return contents != NULL; | 2423 return contents != NULL; |
2421 } | 2424 } |
OLD | NEW |