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

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

Issue 2468673003: [Extensions] Remove ExtensionWebUI (Closed)
Patch Set: nit Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extensions/chrome_content_browser_client_extensions_par t.h" 5 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par t.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/alias.h" 12 #include "base/debug/alias.h"
13 #include "base/debug/dump_without_crashing.h" 13 #include "base/debug/dump_without_crashing.h"
14 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/extensions/extension_service.h" 16 #include "chrome/browser/extensions/extension_service.h"
17 #include "chrome/browser/extensions/extension_web_ui.h" 17 #include "chrome/browser/extensions/extension_web_ui.h"
18 #include "chrome/browser/extensions/extension_webkit_preferences.h" 18 #include "chrome/browser/extensions/extension_webkit_preferences.h"
19 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" 19 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/profiles/profile_io_data.h" 21 #include "chrome/browser/profiles/profile_io_data.h"
22 #include "chrome/browser/profiles/profile_manager.h" 22 #include "chrome/browser/profiles/profile_manager.h"
23 #include "chrome/browser/renderer_host/chrome_extension_message_filter.h" 23 #include "chrome/browser/renderer_host/chrome_extension_message_filter.h"
24 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" 24 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
25 #include "chrome/common/chrome_constants.h" 25 #include "chrome/common/chrome_constants.h"
26 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
27 #include "chrome/common/extensions/extension_constants.h"
27 #include "chrome/common/extensions/extension_process_policy.h" 28 #include "chrome/common/extensions/extension_process_policy.h"
28 #include "components/guest_view/browser/guest_view_message_filter.h" 29 #include "components/guest_view/browser/guest_view_message_filter.h"
29 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
30 #include "content/public/browser/browser_url_handler.h" 31 #include "content/public/browser/browser_url_handler.h"
32 #include "content/public/browser/page_navigator.h"
31 #include "content/public/browser/render_process_host.h" 33 #include "content/public/browser/render_process_host.h"
32 #include "content/public/browser/render_view_host.h" 34 #include "content/public/browser/render_view_host.h"
33 #include "content/public/browser/resource_dispatcher_host.h" 35 #include "content/public/browser/resource_dispatcher_host.h"
34 #include "content/public/browser/site_instance.h" 36 #include "content/public/browser/site_instance.h"
35 #include "content/public/browser/storage_partition.h" 37 #include "content/public/browser/storage_partition.h"
36 #include "content/public/browser/vpn_service_proxy.h" 38 #include "content/public/browser/vpn_service_proxy.h"
37 #include "content/public/browser/web_contents.h" 39 #include "content/public/browser/web_contents.h"
38 #include "content/public/common/content_switches.h" 40 #include "content/public/common/content_switches.h"
39 #include "extensions/browser/api/web_request/web_request_api.h" 41 #include "extensions/browser/api/web_request/web_request_api.h"
40 #include "extensions/browser/api/web_request/web_request_api_helpers.h" 42 #include "extensions/browser/api/web_request/web_request_api_helpers.h"
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); 511 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
510 InfoMap* extension_info_map = io_data->GetExtensionInfoMap(); 512 InfoMap* extension_info_map = io_data->GetExtensionInfoMap();
511 const Extension* extension = 513 const Extension* extension =
512 extension_info_map->extensions().GetExtensionOrAppByURL(first_party_url); 514 extension_info_map->extensions().GetExtensionOrAppByURL(first_party_url);
513 // Don't allow a service worker for an extension url with no extension (this 515 // Don't allow a service worker for an extension url with no extension (this
514 // could happen in the case of, e.g., an unloaded extension). 516 // could happen in the case of, e.g., an unloaded extension).
515 return extension != nullptr; 517 return extension != nullptr;
516 } 518 }
517 519
518 // static 520 // static
521 void ChromeContentBrowserClientExtensionsPart::OverrideNavigationParams(
522 content::SiteInstance* site_instance,
523 ui::PageTransition* transition,
524 bool* is_renderer_initiated,
525 content::Referrer* referrer) {
526 const Extension* extension =
527 ExtensionRegistry::Get(site_instance->GetBrowserContext())
528 ->enabled_extensions()
529 .GetExtensionOrAppByURL(site_instance->GetSiteURL());
530 if (!extension)
531 return;
532
533 if (extension->id() == extension_misc::kBookmarkManagerId &&
534 ui::PageTransitionCoreTypeIs(*transition, ui::PAGE_TRANSITION_LINK)) {
535 // Link clicks in the bookmark manager count as bookmarks and as browser-
536 // initiated navigations.
537 *transition = ui::PAGE_TRANSITION_AUTO_BOOKMARK;
538 *is_renderer_initiated = false;
539 }
540
541 // Hide the referrer for extension pages. We don't want sites to see a
542 // referrer of chrome-extension://<...>.
543 if (extension->is_extension())
544 *referrer = content::Referrer();
545 }
546
547 // static
519 bool ChromeContentBrowserClientExtensionsPart::ShouldAllowOpenURL( 548 bool ChromeContentBrowserClientExtensionsPart::ShouldAllowOpenURL(
520 content::SiteInstance* site_instance, 549 content::SiteInstance* site_instance,
521 const GURL& to_url, 550 const GURL& to_url,
522 bool* result) { 551 bool* result) {
523 DCHECK(result); 552 DCHECK(result);
524 553
525 // Using url::Origin is important to properly handle blob: and filesystem: 554 // Using url::Origin is important to properly handle blob: and filesystem:
526 // URLs. 555 // URLs.
527 url::Origin to_origin(to_url); 556 url::Origin to_origin(to_url);
528 if (to_origin.scheme() != kExtensionScheme) { 557 if (to_origin.scheme() != kExtensionScheme) {
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 command_line->AppendSwitch(switches::kExtensionProcess); 786 command_line->AppendSwitch(switches::kExtensionProcess);
758 } 787 }
759 } 788 }
760 789
761 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() { 790 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() {
762 content::ResourceDispatcherHost::Get()->RegisterInterceptor( 791 content::ResourceDispatcherHost::Get()->RegisterInterceptor(
763 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived)); 792 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived));
764 } 793 }
765 794
766 } // namespace extensions 795 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698