| OLD | NEW |
| 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_NACL_HOST_NACL_BROWSER_DELEGATE_IMPL_H_ | 5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_NACL_BROWSER_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_NACL_HOST_NACL_BROWSER_DELEGATE_IMPL_H_ | 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_NACL_BROWSER_DELEGATE_H_ |
| 7 | |
| 8 #include <set> | |
| 9 #include <string> | |
| 10 | 7 |
| 11 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" |
| 12 #include "components/nacl/browser/nacl_browser_delegate.h" | 10 #include "components/nacl/browser/nacl_browser_delegate.h" |
| 13 #include "extensions/common/url_pattern.h" | 11 |
| 12 namespace content { |
| 13 class BrowserContext; |
| 14 } |
| 14 | 15 |
| 15 namespace extensions { | 16 namespace extensions { |
| 16 class InfoMap; | 17 class InfoMap; |
| 17 } | |
| 18 | 18 |
| 19 class ProfileManager; | 19 // A lightweight NaClBrowserDelegate for app_shell. Only supports a single |
| 20 // BrowserContext. |
| 21 class ShellNaClBrowserDelegate : public NaClBrowserDelegate { |
| 22 public: |
| 23 // Uses |context| to look up extensions via InfoMap on the IO thread. |
| 24 explicit ShellNaClBrowserDelegate(content::BrowserContext* context); |
| 25 virtual ~ShellNaClBrowserDelegate(); |
| 20 | 26 |
| 21 class NaClBrowserDelegateImpl : public NaClBrowserDelegate { | 27 // NaClBrowserDelegate overrides: |
| 22 public: | |
| 23 explicit NaClBrowserDelegateImpl(ProfileManager* profile_manager); | |
| 24 virtual ~NaClBrowserDelegateImpl(); | |
| 25 | |
| 26 virtual void ShowMissingArchInfobar(int render_process_id, | 28 virtual void ShowMissingArchInfobar(int render_process_id, |
| 27 int render_view_id) OVERRIDE; | 29 int render_view_id) OVERRIDE; |
| 28 virtual bool DialogsAreSuppressed() OVERRIDE; | 30 virtual bool DialogsAreSuppressed() OVERRIDE; |
| 29 virtual bool GetCacheDirectory(base::FilePath* cache_dir) OVERRIDE; | 31 virtual bool GetCacheDirectory(base::FilePath* cache_dir) OVERRIDE; |
| 30 virtual bool GetPluginDirectory(base::FilePath* plugin_dir) OVERRIDE; | 32 virtual bool GetPluginDirectory(base::FilePath* plugin_dir) OVERRIDE; |
| 31 virtual bool GetPnaclDirectory(base::FilePath* pnacl_dir) OVERRIDE; | 33 virtual bool GetPnaclDirectory(base::FilePath* pnacl_dir) OVERRIDE; |
| 32 virtual bool GetUserDirectory(base::FilePath* user_dir) OVERRIDE; | 34 virtual bool GetUserDirectory(base::FilePath* user_dir) OVERRIDE; |
| 33 virtual std::string GetVersionString() const OVERRIDE; | 35 virtual std::string GetVersionString() const OVERRIDE; |
| 34 virtual ppapi::host::HostFactory* CreatePpapiHostFactory( | 36 virtual ppapi::host::HostFactory* CreatePpapiHostFactory( |
| 35 content::BrowserPpapiHost* ppapi_host) OVERRIDE; | 37 content::BrowserPpapiHost* ppapi_host) OVERRIDE; |
| 36 virtual bool MapUrlToLocalFilePath(const GURL& url, | 38 virtual bool MapUrlToLocalFilePath(const GURL& url, |
| 37 bool is_blocking, | 39 bool is_blocking, |
| 38 const base::FilePath& profile_directory, | 40 const base::FilePath& profile_directory, |
| 39 base::FilePath* file_path) OVERRIDE; | 41 base::FilePath* file_path) OVERRIDE; |
| 40 virtual void SetDebugPatterns(std::string debug_patterns) OVERRIDE; | 42 virtual void SetDebugPatterns(std::string debug_patterns) OVERRIDE; |
| 41 virtual bool URLMatchesDebugPatterns(const GURL& manifest_url) OVERRIDE; | 43 virtual bool URLMatchesDebugPatterns(const GURL& manifest_url) OVERRIDE; |
| 42 virtual content::BrowserPpapiHost::OnKeepaliveCallback | 44 virtual content::BrowserPpapiHost::OnKeepaliveCallback |
| 43 GetOnKeepaliveCallback() OVERRIDE; | 45 GetOnKeepaliveCallback() OVERRIDE; |
| 44 virtual bool IsNonSfiModeAllowed(const base::FilePath& profile_directory, | 46 virtual bool IsNonSfiModeAllowed(const base::FilePath& profile_directory, |
| 45 const GURL& manifest_url) OVERRIDE; | 47 const GURL& manifest_url) OVERRIDE; |
| 46 | 48 |
| 47 private: | 49 private: |
| 48 scoped_refptr<extensions::InfoMap> GetExtensionInfoMap( | 50 content::BrowserContext* browser_context_; // Not owned. |
| 49 const base::FilePath& profile_directory); | 51 |
| 50 ProfileManager* profile_manager_; | 52 DISALLOW_COPY_AND_ASSIGN(ShellNaClBrowserDelegate); |
| 51 std::vector<URLPattern> debug_patterns_; | |
| 52 bool inverse_debug_patterns_; | |
| 53 std::set<std::string> allowed_nonsfi_origins_; | |
| 54 DISALLOW_COPY_AND_ASSIGN(NaClBrowserDelegateImpl); | |
| 55 }; | 53 }; |
| 56 | 54 |
| 55 } // namespace extensions |
| 57 | 56 |
| 58 #endif // CHROME_BROWSER_NACL_HOST_NACL_BROWSER_DELEGATE_IMPL_H_ | 57 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_NACL_BROWSER_DELEGATE_H_ |
| OLD | NEW |