1 // Copyright 2013 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. 4 5 #ifndef CHROME_BROWSER_NACL_HOST_NACL_BROWSER_DELEGATE_IMPL_H_ 6 #define CHROME_BROWSER_NACL_HOST_NACL_BROWSER_DELEGATE_IMPL_H_ 7 8 #include <set> 9 #include <string> 10 11 #include "base/compiler_specific.h" 12 #include "base/macros.h" 13 #include "components/nacl/browser/nacl_browser_delegate.h" 14 #include "extensions/buildflags/buildflags.h" 15 16 #if BUILDFLAG(ENABLE_EXTENSIONS) 17 #include "base/memory/ref_counted.h" 18 #include "extensions/common/url_pattern.h" 19 #endif 20 21 class ProfileManager; 22 23 class NaClBrowserDelegateImpl : public NaClBrowserDelegate { 24 public: 25 explicit NaClBrowserDelegateImpl(ProfileManager* profile_manager); 26 ~NaClBrowserDelegateImpl() override; 27 28 void ShowMissingArchInfobar(int render_process_id, 29 int render_view_id) override; 30 bool DialogsAreSuppressed() override; 31 bool GetCacheDirectory(base::FilePath* cache_dir) override; 32 bool GetPluginDirectory(base::FilePath* plugin_dir) override; 33 bool GetPnaclDirectory(base::FilePath* pnacl_dir) override; 34 bool GetUserDirectory(base::FilePath* user_dir) override; 35 std::string GetVersionString() const override; 36 ppapi::host::HostFactory* CreatePpapiHostFactory( 37 content::BrowserPpapiHost* ppapi_host) override; 38 MapUrlToLocalFilePathCallback GetMapUrlToLocalFilePathCallback( 39 const base::FilePath& profile_directory) override; 40 void SetDebugPatterns(const std::string& debug_patterns) override; 41 bool URLMatchesDebugPatterns(const GURL& manifest_url) override; 42 bool IsNonSfiModeAllowed(const base::FilePath& profile_directory, 43 const GURL& manifest_url) override; 44 45 private: 46 // Creates a NaCl infobar and delegate for the given render process and view 47 // IDs. Should be called on the UI thread. 48 static void CreateInfoBarOnUiThread(int render_process_id, 49 int render_view_id); 50 51 #if BUILDFLAG(ENABLE_EXTENSIONS) 52 std::vector<URLPattern> debug_patterns_; 53 #endif 54 55 ProfileManager* profile_manager_; 56 bool inverse_debug_patterns_; 57 std::set<std::string> allowed_nonsfi_origins_; 58 DISALLOW_COPY_AND_ASSIGN(NaClBrowserDelegateImpl); 59 }; 60 61 62 #endif // CHROME_BROWSER_NACL_HOST_NACL_BROWSER_DELEGATE_IMPL_H_ 63