Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / common / chrome_content_client.h
blobdab975b6489afcc314ca8a876dd3210fe01b80a2
1 // Copyright (c) 2012 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_COMMON_CHROME_CONTENT_CLIENT_H_
6 #define CHROME_COMMON_CHROME_CONTENT_CLIENT_H_
8 #include <string>
9 #include <vector>
11 #include "base/compiler_specific.h"
12 #include "base/files/file_path.h"
13 #include "content/public/common/content_client.h"
15 #if defined(ENABLE_PLUGINS)
16 #include "content/public/common/pepper_plugin_info.h"
17 #endif
19 #include "url/url_util.h"
21 // Returns the user agent of Chrome.
22 std::string GetUserAgent();
24 class ChromeContentClient : public content::ContentClient {
25 public:
26 static const char kPDFPluginName[];
27 static const char kPDFPluginPath[];
28 static const char kRemotingViewerPluginPath[];
30 // The methods below are called by child processes to set the function
31 // pointers for built-in plugins. We avoid linking these plugins into
32 // chrome_common because then on Windows we would ship them twice because of
33 // the split DLL.
34 #if !defined(DISABLE_NACL)
35 static void SetNaClEntryFunctions(
36 content::PepperPluginInfo::GetInterfaceFunc get_interface,
37 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module,
38 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module);
39 #endif
41 #if defined(ENABLE_PLUGINS)
42 static void SetPDFEntryFunctions(
43 content::PepperPluginInfo::GetInterfaceFunc get_interface,
44 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module,
45 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module);
47 // This returns the most recent plugin based on the plugin versions.
48 // It does not make sense to call this on a vector that contains more than one
49 // plugin type. This function may return a nullptr if given an empty vector.
50 // The method is only visible for testing purposes.
51 static content::PepperPluginInfo* FindMostRecentPlugin(
52 const std::vector<content::PepperPluginInfo*>& plugins);
53 #endif
55 void SetActiveURL(const GURL& url) override;
56 void SetGpuInfo(const gpu::GPUInfo& gpu_info) override;
57 void AddPepperPlugins(
58 std::vector<content::PepperPluginInfo>* plugins) override;
59 void AddAdditionalSchemes(std::vector<url::SchemeWithType>* standard_schemes,
60 std::vector<std::string>* saveable_shemes) override;
61 std::string GetProduct() const override;
62 std::string GetUserAgent() const override;
63 base::string16 GetLocalizedString(int message_id) const override;
64 base::StringPiece GetDataResource(
65 int resource_id,
66 ui::ScaleFactor scale_factor) const override;
67 base::RefCountedStaticMemory* GetDataResourceBytes(
68 int resource_id) const override;
69 gfx::Image& GetNativeImageNamed(int resource_id) const override;
70 std::string GetProcessTypeNameInEnglish(int type) override;
72 #if defined(OS_MACOSX) && !defined(OS_IOS)
73 bool GetSandboxProfileForSandboxType(
74 int sandbox_type,
75 int* sandbox_profile_resource_id) const override;
76 #endif
78 void AddSecureSchemesAndOrigins(std::set<std::string>* schemes,
79 std::set<GURL>* origins) override;
81 void AddServiceWorkerSchemes(std::set<std::string>* schemes) override;
84 #endif // CHROME_COMMON_CHROME_CONTENT_CLIENT_H_