Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / chrome / browser / extensions / chrome_content_browser_client_extensions_part.h
blobfbdad7f8a9f137e38a2b97ff529528045971251e
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_CONTENT_BROWSER_CLIENT_EXTENSIONS_PART_H_
6 #define CHROME_BROWSER_EXTENSIONS_CHROME_CONTENT_BROWSER_CLIENT_EXTENSIONS_PART_H_
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "chrome/browser/chrome_content_browser_client_parts.h"
12 namespace content {
13 class ResourceContext;
16 namespace extensions {
18 class BrowserPermissionsPolicyDelegate;
20 // Implements the extensions portion of ChromeContentBrowserClient.
21 class ChromeContentBrowserClientExtensionsPart
22 : public ChromeContentBrowserClientParts {
23 public:
24 ChromeContentBrowserClientExtensionsPart();
25 ~ChromeContentBrowserClientExtensionsPart() override;
27 // Corresponds to the ChromeContentBrowserClient function of the same name.
28 static GURL GetEffectiveURL(Profile* profile, const GURL& url);
29 static bool ShouldUseProcessPerSite(Profile* profile,
30 const GURL& effective_url);
31 static bool ShouldLockToOrigin(content::BrowserContext* browser_context,
32 const GURL& effective_site_url);
33 static bool CanCommitURL(content::RenderProcessHost* process_host,
34 const GURL& url);
35 static bool IsIllegalOrigin(content::ResourceContext* resource_context,
36 int child_process_id,
37 const GURL& origin);
38 static bool IsSuitableHost(Profile* profile,
39 content::RenderProcessHost* process_host,
40 const GURL& site_url);
41 static bool ShouldTryToUseExistingProcessHost(Profile* profile,
42 const GURL& url);
43 static bool ShouldSwapBrowsingInstancesForNavigation(
44 content::SiteInstance* site_instance,
45 const GURL& current_url,
46 const GURL& new_url);
47 static bool ShouldSwapProcessesForRedirect(
48 content::ResourceContext* resource_context,
49 const GURL& current_url,
50 const GURL& new_url);
51 static bool AllowServiceWorker(const GURL& scope,
52 const GURL& first_party_url,
53 content::ResourceContext* context,
54 int render_process_id,
55 int render_frame_id);
57 // Similiar to ChromeContentBrowserClient::ShouldAllowOpenURL(), but the
58 // return value indicates whether to use |result| or not.
59 static bool ShouldAllowOpenURL(content::SiteInstance* site_instance,
60 const GURL& from_url,
61 const GURL& to_url,
62 bool* result);
64 // Helper function to call InfoMap::SetSigninProcess().
65 static void SetSigninProcess(content::SiteInstance* site_instance);
67 private:
68 // ChromeContentBrowserClientParts:
69 void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
70 void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
71 void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
72 void OverrideWebkitPrefs(content::RenderViewHost* rvh,
73 content::WebPreferences* web_prefs) override;
74 void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
75 void GetAdditionalAllowedSchemesForFileSystem(
76 std::vector<std::string>* additional_allowed_schemes) override;
77 void GetURLRequestAutoMountHandlers(
78 std::vector<storage::URLRequestAutoMountHandler>* handlers) override;
79 void GetAdditionalFileSystemBackends(
80 content::BrowserContext* browser_context,
81 const base::FilePath& storage_partition_path,
82 ScopedVector<storage::FileSystemBackend>* additional_backends) override;
83 void AppendExtraRendererCommandLineSwitches(
84 base::CommandLine* command_line,
85 content::RenderProcessHost* process,
86 Profile* profile) override;
88 scoped_ptr<BrowserPermissionsPolicyDelegate> permissions_policy_delegate_;
90 DISALLOW_COPY_AND_ASSIGN(ChromeContentBrowserClientExtensionsPart);
93 } // namespace extensions
95 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_CONTENT_BROWSER_CLIENT_EXTENSIONS_PART_H_