// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/browser/content_browser_client.h"
#include "base/files/file_path.h"
#include "ui/gfx/image/image_skia.h"
#include "url/gurl.h"
namespace content {
BrowserMainParts* ContentBrowserClient::CreateBrowserMainParts(
const MainFunctionParams& parameters) {
return NULL;
}
WebContentsViewDelegate* ContentBrowserClient::GetWebContentsViewDelegate(
WebContents* web_contents) {
return NULL;
}
GURL ContentBrowserClient::GetEffectiveURL(BrowserContext* browser_context,
const GURL& url) {
return url;
}
bool ContentBrowserClient::ShouldUseProcessPerSite(
BrowserContext* browser_context, const GURL& effective_url) {
return false;
}
net::URLRequestContextGetter* ContentBrowserClient::CreateRequestContext(
BrowserContext* browser_context,
ProtocolHandlerMap* protocol_handlers,
URLRequestInterceptorScopedVector request_interceptors) {
return NULL;
}
net::URLRequestContextGetter*
ContentBrowserClient::CreateRequestContextForStoragePartition(
BrowserContext* browser_context,
const base::FilePath& partition_path,
bool in_memory,
ProtocolHandlerMap* protocol_handlers,
URLRequestInterceptorScopedVector request_interceptors) {
return NULL;
}
bool ContentBrowserClient::IsHandledURL(const GURL& url) {
return false;
}
bool ContentBrowserClient::CanCommitURL(RenderProcessHost* process_host,
const GURL& site_url) {
return true;
}
bool ContentBrowserClient::ShouldAllowOpenURL(SiteInstance* site_instance,
const GURL& url) {
return true;
}
bool ContentBrowserClient::IsSuitableHost(RenderProcessHost* process_host,
const GURL& site_url) {
return true;
}
bool ContentBrowserClient::MayReuseHost(RenderProcessHost* process_host) {
return true;
}
bool ContentBrowserClient::ShouldTryToUseExistingProcessHost(
BrowserContext* browser_context, const GURL& url) {
return false;
}
bool ContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
SiteInstance* site_instance,
const GURL& current_url,
const GURL& new_url) {
return false;
}
bool ContentBrowserClient::ShouldSwapProcessesForRedirect(
ResourceContext* resource_context, const GURL& current_url,
const GURL& new_url) {
return false;
}
bool ContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) {
return true;
}
std::string ContentBrowserClient::GetCanonicalEncodingNameByAliasName(
const std::string& alias_name) {
return std::string();
}
std::string ContentBrowserClient::GetApplicationLocale() {
return "en-US";
}
std::string ContentBrowserClient::GetAcceptLangs(BrowserContext* context) {
return std::string();
}
const gfx::ImageSkia* ContentBrowserClient::GetDefaultFavicon() {
static gfx::ImageSkia* empty = new gfx::ImageSkia();
return empty;
}
bool ContentBrowserClient::AllowAppCache(const GURL& manifest_url,
const GURL& first_party,
ResourceContext* context) {
return true;
}
bool ContentBrowserClient::AllowGetCookie(const GURL& url,
const GURL& first_party,
const net::CookieList& cookie_list,
ResourceContext* context,
int render_process_id,
int render_frame_id) {
return true;
}
bool ContentBrowserClient::AllowSetCookie(const GURL& url,
const GURL& first_party,
const std::string& cookie_line,
ResourceContext* context,
int render_process_id,
int render_frame_id,
net::CookieOptions* options) {
return true;
}
bool ContentBrowserClient::AllowSaveLocalState(ResourceContext* context) {
return true;
}
bool ContentBrowserClient::AllowWorkerDatabase(
const GURL& url,
const base::string16& name,
const base::string16& display_name,
unsigned long estimated_size,
ResourceContext* context,
const std::vector<std::pair<int, int> >& render_frames) {
return true;
}
void ContentBrowserClient::AllowWorkerFileSystem(
const GURL& url,
ResourceContext* context,
const std::vector<std::pair<int, int> >& render_frames,
base::Callback<void(bool)> callback) {
callback.Run(true);
}
bool ContentBrowserClient::AllowWorkerIndexedDB(
const GURL& url,
const base::string16& name,
ResourceContext* context,
const std::vector<std::pair<int, int> >& render_frames) {
return true;
}
QuotaPermissionContext* ContentBrowserClient::CreateQuotaPermissionContext() {
return NULL;
}
net::URLRequestContext* ContentBrowserClient::OverrideRequestContextForURL(
const GURL& url, ResourceContext* context) {
return NULL;
}
std::string ContentBrowserClient::GetStoragePartitionIdForSite(
BrowserContext* browser_context,
const GURL& site) {
return std::string();
}
bool ContentBrowserClient::IsValidStoragePartitionId(
BrowserContext* browser_context,
const std::string& partition_id) {
// Since the GetStoragePartitionIdForChildProcess() only generates empty
// strings, we should only ever see empty strings coming back.
return partition_id.empty();
}
void ContentBrowserClient::GetStoragePartitionConfigForSite(
BrowserContext* browser_context,
const GURL& site,
bool can_be_default,
std::string* partition_domain,
std::string* partition_name,
bool* in_memory) {
partition_domain->clear();
partition_name->clear();
*in_memory = false;
}
MediaObserver* ContentBrowserClient::GetMediaObserver() {
return NULL;
}
blink::WebNotificationPermission
ContentBrowserClient::CheckDesktopNotificationPermission(
const GURL& source_origin,
ResourceContext* context,
int render_process_id) {
return blink::WebNotificationPermissionAllowed;
}
void ContentBrowserClient::RequestGeolocationPermission(
WebContents* web_contents,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
base::Callback<void(bool)> result_callback,
base::Closure* cancel_callback) {
result_callback.Run(true);
}
void ContentBrowserClient::RequestMidiSysExPermission(
WebContents* web_contents,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
base::Callback<void(bool)> result_callback,
base::Closure* cancel_callback) {
result_callback.Run(true);
}
void ContentBrowserClient::RequestProtectedMediaIdentifierPermission(
WebContents* web_contents,
const GURL& origin,
base::Callback<void(bool)> result_callback,
base::Closure* cancel_callback) {
result_callback.Run(true);
}
bool ContentBrowserClient::CanCreateWindow(
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
WindowContainerType container_type,
const GURL& target_url,
const Referrer& referrer,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
bool user_gesture,
bool opener_suppressed,
ResourceContext* context,
int render_process_id,
int opener_id,
bool* no_javascript_access) {
*no_javascript_access = false;
return true;
}
SpeechRecognitionManagerDelegate*
ContentBrowserClient::GetSpeechRecognitionManagerDelegate() {
return NULL;
}
net::NetLog* ContentBrowserClient::GetNetLog() {
return NULL;
}
AccessTokenStore* ContentBrowserClient::CreateAccessTokenStore() {
return NULL;
}
bool ContentBrowserClient::IsFastShutdownPossible() {
return true;
}
base::FilePath ContentBrowserClient::GetDefaultDownloadDirectory() {
return base::FilePath();
}
std::string ContentBrowserClient::GetDefaultDownloadName() {
return std::string();
}
BrowserPpapiHost*
ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id) {
return NULL;
}
bool ContentBrowserClient::AllowPepperSocketAPI(
BrowserContext* browser_context,
const GURL& url,
bool private_api,
const SocketPermissionRequest* params) {
return false;
}
ui::SelectFilePolicy* ContentBrowserClient::CreateSelectFilePolicy(
WebContents* web_contents) {
return NULL;
}
LocationProvider* ContentBrowserClient::OverrideSystemLocationProvider() {
return NULL;
}
VibrationProvider* ContentBrowserClient::OverrideVibrationProvider() {
return NULL;
}
DevToolsManagerDelegate* ContentBrowserClient::GetDevToolsManagerDelegate() {
return NULL;
}
bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
BrowserContext* browser_context,
const GURL& url) {
return false;
}
bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
BrowserContext* browser_context,
const GURL& url) {
return false;
}
net::CookieStore* ContentBrowserClient::OverrideCookieStoreForRenderProcess(
int render_process_id) {
return NULL;
}
#if defined(OS_WIN)
const wchar_t* ContentBrowserClient::GetResourceDllName() {
return NULL;
}
#endif
#if defined(VIDEO_HOLE)
ExternalVideoSurfaceContainer*
ContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer(
WebContents* web_contents) {
return NULL;
}
#endif
bool ContentBrowserClient::CheckMediaAccessPermission(
BrowserContext* browser_context,
const GURL& security_origin,
MediaStreamType type) {
return false;
}
} // namespace content