17dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Copyright 2013 The Chromium Authors. All rights reserved. 27dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Use of this source code is governed by a BSD-style license that can be 37dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// found in the LICENSE file. 47dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 5f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#ifndef COMPONENTS_NACL_BROWSER_NACL_BROWSER_DELEGATE_H_ 6f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#define COMPONENTS_NACL_BROWSER_NACL_BROWSER_DELEGATE_H_ 77dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 87dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include <string> 97dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 10a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#include "base/callback_forward.h" 115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/public/browser/browser_ppapi_host.h" 12a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class GURL; 148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 157dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochnamespace base { 167dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochclass FilePath; 177dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch} 187dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 197dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochnamespace ppapi { 207dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochnamespace host { 217dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochclass HostFactory; 227dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch} 237dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch} 247dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 257dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Encapsulates the dependencies of NaCl code on chrome/, to avoid a direct 267dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// dependency on chrome/. 277dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochclass NaClBrowserDelegate { 287dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch public: 297dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual ~NaClBrowserDelegate() {} 307dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Show an infobar to the user to indicate the client architecture was not 32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // covered by the manifest. 33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void ShowMissingArchInfobar(int render_process_id, 34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int render_view_id) = 0; 357dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // Returns whether dialogs are allowed. This is used to decide if to add the 367dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // command line switch kNoErrorDialogs. 377dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual bool DialogsAreSuppressed() = 0; 387dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // Returns true on success, false otherwise. On success |cache_dir| contains 397dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // the cache directory. On failure, it is not changed. 407dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual bool GetCacheDirectory(base::FilePath* cache_dir) = 0; 417dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // Returns true on success, false otherwise. On success |plugin_dir| contains 427dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // the directory where the plugins are located. On failure, it is not 437dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // changed. 447dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual bool GetPluginDirectory(base::FilePath* plugin_dir) = 0; 457dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // Returns true on success, false otherwise. On success |pnacl_dir| contains 467dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // the directory where the PNaCl files are located. On failure, it is not 477dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // changed. 487dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual bool GetPnaclDirectory(base::FilePath* pnacl_dir) = 0; 497dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // Returns true on success, false otherwise. On success |user_dir| contains 507dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // the user data directory. On failure, it is not changed. 517dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual bool GetUserDirectory(base::FilePath* user_dir) = 0; 527dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // Returns the version as a string. This string is used to invalidate 537dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // validator cache entries when Chromium is upgraded 547dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual std::string GetVersionString() const = 0; 557dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // Returns a HostFactory that hides the details of its embedder. 567dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual ppapi::host::HostFactory* CreatePpapiHostFactory( 577dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch content::BrowserPpapiHost* ppapi_host) = 0; 588bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // Returns true on success, false otherwise. On success, map |url| to a 598bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // full pathname of a file in the local filesystem. |file_path| should not be 608bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // changed on failure. This mapping should be a best effort, for example, 618bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // "chrome-extension:" could be mapped to the location of unpacked 628bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // extensions. If this method is called in a blocking thread you should set 638bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // |use_blocking_api| to true, so calling blocking file API is allowed 648bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // otherwise non blocking API will be used (which only handles a subset of the 658bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // urls checking only the url scheme against kExtensionScheme). 668bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual bool MapUrlToLocalFilePath(const GURL& url, 678bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) bool use_blocking_api, 68010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) const base::FilePath& profile_directory, 698bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) base::FilePath* file_path) = 0; 701e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // Set match patterns which will be checked before enabling debug stub. 711e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void SetDebugPatterns(std::string debug_patterns) = 0; 721e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 731e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // Returns whether NaCl application with this manifest URL should be debugged. 741e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual bool URLMatchesDebugPatterns(const GURL& manifest_url) = 0; 755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Returns a callback that handles NaCl idle state transitions. 775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual content::BrowserPpapiHost::OnKeepaliveCallback 785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) GetOnKeepaliveCallback() = 0; 79cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 80cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Returns whether Non-SFI mode is allowed for a given manifest URL. 81cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsNonSfiModeAllowed(const base::FilePath& profile_directory, 82cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const GURL& manifest_url) = 0; 837dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch}; 847dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 85f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#endif // COMPONENTS_NACL_BROWSER_NACL_BROWSER_DELEGATE_H_ 86