Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / common / chrome_content_client.h
blob7e60fb6057368ff143d3131702a2dda6c0f87475
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 bool CanSendWhileSwappedOut(const IPC::Message* message) override;
62 std::string GetProduct() const override;
63 std::string GetUserAgent() const override;
64 base::string16 GetLocalizedString(int message_id) const override;
65 base::StringPiece GetDataResource(
66 int resource_id,
67 ui::ScaleFactor scale_factor) const override;
68 base::RefCountedStaticMemory* GetDataResourceBytes(
69 int resource_id) const override;
70 gfx::Image& GetNativeImageNamed(int resource_id) const override;
71 std::string GetProcessTypeNameInEnglish(int type) override;
73 #if defined(OS_MACOSX) && !defined(OS_IOS)
74 bool GetSandboxProfileForSandboxType(
75 int sandbox_type,
76 int* sandbox_profile_resource_id) const override;
77 #endif
79 void AddSecureSchemesAndOrigins(std::set<std::string>* schemes,
80 std::set<GURL>* origins) override;
82 void AddServiceWorkerSchemes(std::set<std::string>* schemes) override;
85 #endif // CHROME_COMMON_CHROME_CONTENT_CLIENT_H_