Adding instrumentation to locate the source of jankiness
[chromium-blink-merge.git] / chrome / browser / extensions / chrome_content_browser_client_extensions_part.h
blobeecb554eecc6721d444a0e6777250aa65d0e129f
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 virtual ~ChromeContentBrowserClientExtensionsPart();
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 CanCommitURL(content::RenderProcessHost* process_host,
32 const GURL& url);
33 static bool IsSuitableHost(Profile* profile,
34 content::RenderProcessHost* process_host,
35 const GURL& site_url);
36 static bool ShouldTryToUseExistingProcessHost(Profile* profile,
37 const GURL& url);
38 static bool ShouldSwapBrowsingInstancesForNavigation(
39 content::SiteInstance* site_instance,
40 const GURL& current_url,
41 const GURL& new_url);
42 static bool ShouldSwapProcessesForRedirect(
43 content::ResourceContext* resource_context,
44 const GURL& current_url,
45 const GURL& new_url);
47 // Similiar to ChromeContentBrowserClient::ShouldAllowOpenURL(), but the
48 // return value indicates whether to use |result| or not.
49 static bool ShouldAllowOpenURL(content::SiteInstance* site_instance,
50 const GURL& from_url,
51 const GURL& to_url,
52 bool* result);
54 // Helper function to call InfoMap::SetSigninProcess().
55 static void SetSigninProcess(content::SiteInstance* site_instance);
57 private:
58 // ChromeContentBrowserClientParts:
59 virtual void RenderProcessWillLaunch(
60 content::RenderProcessHost* host) override;
61 virtual void SiteInstanceGotProcess(
62 content::SiteInstance* site_instance) override;
63 virtual void SiteInstanceDeleting(
64 content::SiteInstance* site_instance) override;
65 virtual void OverrideWebkitPrefs(content::RenderViewHost* rvh,
66 const GURL& url,
67 content::WebPreferences* web_prefs) override;
68 virtual void BrowserURLHandlerCreated(
69 content::BrowserURLHandler* handler) override;
70 virtual void GetAdditionalAllowedSchemesForFileSystem(
71 std::vector<std::string>* additional_allowed_schemes) override;
72 virtual void GetURLRequestAutoMountHandlers(
73 std::vector<storage::URLRequestAutoMountHandler>* handlers) override;
74 virtual void GetAdditionalFileSystemBackends(
75 content::BrowserContext* browser_context,
76 const base::FilePath& storage_partition_path,
77 ScopedVector<storage::FileSystemBackend>* additional_backends) override;
78 virtual void AppendExtraRendererCommandLineSwitches(
79 base::CommandLine* command_line,
80 content::RenderProcessHost* process,
81 Profile* profile) override;
83 scoped_ptr<BrowserPermissionsPolicyDelegate> permissions_policy_delegate_;
85 DISALLOW_COPY_AND_ASSIGN(ChromeContentBrowserClientExtensionsPart);
88 } // namespace extensions
90 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_CONTENT_BROWSER_CLIENT_EXTENSIONS_PART_H_