OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "ash/shell/content_client/shell_content_browser_client.h" |
| 6 |
| 7 #include "ash/shell/content_client/shell_browser_main_parts.h" |
| 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" |
| 10 #include "content/public/browser/resource_dispatcher_host.h" |
| 11 #include "content/shell/shell.h" |
| 12 #include "content/shell/shell_devtools_delegate.h" |
| 13 #include "content/shell/shell_render_view_host_observer.h" |
| 14 #include "content/shell/shell_resource_dispatcher_host_delegate.h" |
| 15 #include "content/shell/shell_switches.h" |
| 16 #include "googleurl/src/gurl.h" |
| 17 #include "third_party/skia/include/core/SkBitmap.h" |
| 18 |
| 19 namespace ash { |
| 20 namespace shell { |
| 21 |
| 22 ShellContentBrowserClient::ShellContentBrowserClient() |
| 23 : shell_browser_main_parts_(NULL) { |
| 24 } |
| 25 |
| 26 ShellContentBrowserClient::~ShellContentBrowserClient() { |
| 27 } |
| 28 |
| 29 content::BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( |
| 30 const content::MainFunctionParams& parameters) { |
| 31 shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); |
| 32 return shell_browser_main_parts_; |
| 33 } |
| 34 |
| 35 content::WebContentsView* |
| 36 ShellContentBrowserClient::OverrideCreateWebContentsView( |
| 37 content::WebContents* web_contents) { |
| 38 return NULL; |
| 39 } |
| 40 |
| 41 content::WebContentsViewDelegate* |
| 42 ShellContentBrowserClient::GetWebContentsViewDelegate( |
| 43 content::WebContents* web_contents) { |
| 44 return NULL; |
| 45 } |
| 46 |
| 47 void ShellContentBrowserClient::RenderViewHostCreated( |
| 48 content::RenderViewHost* render_view_host) { |
| 49 new content::ShellRenderViewHostObserver(render_view_host); |
| 50 } |
| 51 |
| 52 void ShellContentBrowserClient::RenderProcessHostCreated( |
| 53 content::RenderProcessHost* host) { |
| 54 } |
| 55 |
| 56 content::WebUIControllerFactory* |
| 57 ShellContentBrowserClient::GetWebUIControllerFactory() { |
| 58 return NULL; |
| 59 } |
| 60 |
| 61 GURL ShellContentBrowserClient::GetEffectiveURL( |
| 62 content::BrowserContext* browser_context, const GURL& url) { |
| 63 return GURL(); |
| 64 } |
| 65 |
| 66 bool ShellContentBrowserClient::ShouldUseProcessPerSite( |
| 67 content::BrowserContext* browser_context, const GURL& effective_url) { |
| 68 return false; |
| 69 } |
| 70 |
| 71 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { |
| 72 return false; |
| 73 } |
| 74 |
| 75 bool ShellContentBrowserClient::IsSuitableHost( |
| 76 content::RenderProcessHost* process_host, |
| 77 const GURL& site_url) { |
| 78 return true; |
| 79 } |
| 80 |
| 81 bool ShellContentBrowserClient::ShouldTryToUseExistingProcessHost( |
| 82 content::BrowserContext* browser_context, const GURL& url) { |
| 83 return false; |
| 84 } |
| 85 |
| 86 void ShellContentBrowserClient::SiteInstanceGotProcess( |
| 87 content::SiteInstance* site_instance) { |
| 88 } |
| 89 |
| 90 void ShellContentBrowserClient::SiteInstanceDeleting( |
| 91 content::SiteInstance* site_instance) { |
| 92 } |
| 93 |
| 94 bool ShellContentBrowserClient::ShouldSwapProcessesForNavigation( |
| 95 const GURL& current_url, |
| 96 const GURL& new_url) { |
| 97 return false; |
| 98 } |
| 99 |
| 100 std::string ShellContentBrowserClient::GetCanonicalEncodingNameByAliasName( |
| 101 const std::string& alias_name) { |
| 102 return std::string(); |
| 103 } |
| 104 |
| 105 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
| 106 CommandLine* command_line, int child_process_id) { |
| 107 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 108 command_line->AppendSwitch(switches::kDumpRenderTree); |
| 109 } |
| 110 |
| 111 std::string ShellContentBrowserClient::GetApplicationLocale() { |
| 112 return std::string(); |
| 113 } |
| 114 |
| 115 std::string ShellContentBrowserClient::GetAcceptLangs( |
| 116 content::BrowserContext* context) { |
| 117 return std::string(); |
| 118 } |
| 119 |
| 120 SkBitmap* ShellContentBrowserClient::GetDefaultFavicon() { |
| 121 static SkBitmap empty; |
| 122 return ∅ |
| 123 } |
| 124 |
| 125 bool ShellContentBrowserClient::AllowAppCache( |
| 126 const GURL& manifest_url, |
| 127 const GURL& first_party, |
| 128 content::ResourceContext* context) { |
| 129 return true; |
| 130 } |
| 131 |
| 132 bool ShellContentBrowserClient::AllowGetCookie( |
| 133 const GURL& url, |
| 134 const GURL& first_party, |
| 135 const net::CookieList& cookie_list, |
| 136 content::ResourceContext* context, |
| 137 int render_process_id, |
| 138 int render_view_id) { |
| 139 return true; |
| 140 } |
| 141 |
| 142 bool ShellContentBrowserClient::AllowSetCookie( |
| 143 const GURL& url, |
| 144 const GURL& first_party, |
| 145 const std::string& cookie_line, |
| 146 content::ResourceContext* context, |
| 147 int render_process_id, |
| 148 int render_view_id, |
| 149 net::CookieOptions* options) { |
| 150 return true; |
| 151 } |
| 152 |
| 153 bool ShellContentBrowserClient::AllowSaveLocalState( |
| 154 content::ResourceContext* context) { |
| 155 return true; |
| 156 } |
| 157 |
| 158 bool ShellContentBrowserClient::AllowWorkerDatabase( |
| 159 const GURL& url, |
| 160 const string16& name, |
| 161 const string16& display_name, |
| 162 unsigned long estimated_size, |
| 163 content::ResourceContext* context, |
| 164 const std::vector<std::pair<int, int> >& render_views) { |
| 165 return true; |
| 166 } |
| 167 |
| 168 bool ShellContentBrowserClient::AllowWorkerFileSystem( |
| 169 const GURL& url, |
| 170 content::ResourceContext* context, |
| 171 const std::vector<std::pair<int, int> >& render_views) { |
| 172 return true; |
| 173 } |
| 174 |
| 175 bool ShellContentBrowserClient::AllowWorkerIndexedDB( |
| 176 const GURL& url, |
| 177 const string16& name, |
| 178 content::ResourceContext* context, |
| 179 const std::vector<std::pair<int, int> >& render_views) { |
| 180 return true; |
| 181 } |
| 182 |
| 183 content::QuotaPermissionContext* |
| 184 ShellContentBrowserClient::CreateQuotaPermissionContext() { |
| 185 return NULL; |
| 186 } |
| 187 |
| 188 net::URLRequestContext* |
| 189 ShellContentBrowserClient::OverrideRequestContextForURL( |
| 190 const GURL& url, content::ResourceContext* context) { |
| 191 return NULL; |
| 192 } |
| 193 |
| 194 void ShellContentBrowserClient::OpenItem(const FilePath& path) { |
| 195 } |
| 196 |
| 197 void ShellContentBrowserClient::ShowItemInFolder(const FilePath& path) { |
| 198 } |
| 199 |
| 200 void ShellContentBrowserClient::AllowCertificateError( |
| 201 int render_process_id, |
| 202 int render_view_id, |
| 203 int cert_error, |
| 204 const net::SSLInfo& ssl_info, |
| 205 const GURL& request_url, |
| 206 bool overridable, |
| 207 const base::Callback<void(bool)>& callback, |
| 208 bool* cancel_request) { |
| 209 } |
| 210 |
| 211 void ShellContentBrowserClient::SelectClientCertificate( |
| 212 int render_process_id, |
| 213 int render_view_id, |
| 214 const net::HttpNetworkSession* network_session, |
| 215 net::SSLCertRequestInfo* cert_request_info, |
| 216 const base::Callback<void(net::X509Certificate*)>& callback) { |
| 217 } |
| 218 |
| 219 void ShellContentBrowserClient::AddNewCertificate( |
| 220 net::URLRequest* request, |
| 221 net::X509Certificate* cert, |
| 222 int render_process_id, |
| 223 int render_view_id) { |
| 224 } |
| 225 |
| 226 void ShellContentBrowserClient::RequestMediaAccessPermission( |
| 227 const content::MediaStreamRequest* request, |
| 228 const content::MediaResponseCallback& callback) { |
| 229 } |
| 230 |
| 231 content::MediaObserver* ShellContentBrowserClient::GetMediaObserver() { |
| 232 return NULL; |
| 233 } |
| 234 |
| 235 void ShellContentBrowserClient::RequestDesktopNotificationPermission( |
| 236 const GURL& source_origin, |
| 237 int callback_context, |
| 238 int render_process_id, |
| 239 int render_view_id) { |
| 240 } |
| 241 |
| 242 WebKit::WebNotificationPresenter::Permission |
| 243 ShellContentBrowserClient::CheckDesktopNotificationPermission( |
| 244 const GURL& source_origin, |
| 245 content::ResourceContext* context, |
| 246 int render_process_id) { |
| 247 return WebKit::WebNotificationPresenter::PermissionAllowed; |
| 248 } |
| 249 |
| 250 void ShellContentBrowserClient::ShowDesktopNotification( |
| 251 const content::ShowDesktopNotificationHostMsgParams& params, |
| 252 int render_process_id, |
| 253 int render_view_id, |
| 254 bool worker) { |
| 255 } |
| 256 |
| 257 void ShellContentBrowserClient::CancelDesktopNotification( |
| 258 int render_process_id, |
| 259 int render_view_id, |
| 260 int notification_id) { |
| 261 } |
| 262 |
| 263 bool ShellContentBrowserClient::CanCreateWindow( |
| 264 const GURL& opener_url, |
| 265 const GURL& origin, |
| 266 WindowContainerType container_type, |
| 267 content::ResourceContext* context, |
| 268 int render_process_id, |
| 269 bool* no_javascript_access) { |
| 270 *no_javascript_access = false; |
| 271 return true; |
| 272 } |
| 273 |
| 274 std::string ShellContentBrowserClient::GetWorkerProcessTitle( |
| 275 const GURL& url, content::ResourceContext* context) { |
| 276 return std::string(); |
| 277 } |
| 278 |
| 279 void ShellContentBrowserClient::ResourceDispatcherHostCreated() { |
| 280 resource_dispatcher_host_delegate_.reset( |
| 281 new content::ShellResourceDispatcherHostDelegate); |
| 282 content::ResourceDispatcherHost::Get()->SetDelegate( |
| 283 resource_dispatcher_host_delegate_.get()); |
| 284 } |
| 285 |
| 286 content::SpeechRecognitionManagerDelegate* |
| 287 ShellContentBrowserClient::GetSpeechRecognitionManagerDelegate() { |
| 288 return NULL; |
| 289 } |
| 290 |
| 291 ui::Clipboard* ShellContentBrowserClient::GetClipboard() { |
| 292 return shell_browser_main_parts_->GetClipboard(); |
| 293 } |
| 294 |
| 295 net::NetLog* ShellContentBrowserClient::GetNetLog() { |
| 296 return NULL; |
| 297 } |
| 298 |
| 299 content::AccessTokenStore* |
| 300 ShellContentBrowserClient::CreateAccessTokenStore() { |
| 301 return NULL; |
| 302 } |
| 303 |
| 304 bool ShellContentBrowserClient::IsFastShutdownPossible() { |
| 305 return true; |
| 306 } |
| 307 |
| 308 void ShellContentBrowserClient::OverrideWebkitPrefs( |
| 309 content::RenderViewHost* rvh, |
| 310 const GURL& url, |
| 311 WebPreferences* prefs) { |
| 312 } |
| 313 |
| 314 void ShellContentBrowserClient::UpdateInspectorSetting( |
| 315 content::RenderViewHost* rvh, |
| 316 const std::string& key, |
| 317 const std::string& value) { |
| 318 } |
| 319 |
| 320 void ShellContentBrowserClient::ClearInspectorSettings( |
| 321 content::RenderViewHost* rvh) { |
| 322 } |
| 323 |
| 324 void ShellContentBrowserClient::BrowserURLHandlerCreated( |
| 325 content::BrowserURLHandler* handler) { |
| 326 } |
| 327 |
| 328 void ShellContentBrowserClient::ClearCache(content::RenderViewHost* rvh) { |
| 329 } |
| 330 |
| 331 void ShellContentBrowserClient::ClearCookies(content::RenderViewHost* rvh) { |
| 332 } |
| 333 |
| 334 FilePath ShellContentBrowserClient::GetDefaultDownloadDirectory() { |
| 335 return FilePath(); |
| 336 } |
| 337 |
| 338 std::string ShellContentBrowserClient::GetDefaultDownloadName() { |
| 339 return "download"; |
| 340 } |
| 341 |
| 342 bool ShellContentBrowserClient::AllowSocketAPI( |
| 343 content::BrowserContext* browser_context, |
| 344 const GURL& url) { |
| 345 return false; |
| 346 } |
| 347 |
| 348 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 349 int ShellContentBrowserClient::GetCrashSignalFD( |
| 350 const CommandLine& command_line) { |
| 351 return -1; |
| 352 } |
| 353 #endif |
| 354 |
| 355 #if defined(OS_WIN) |
| 356 const wchar_t* ShellContentBrowserClient::GetResourceDllName() { |
| 357 return NULL; |
| 358 } |
| 359 #endif |
| 360 |
| 361 #if defined(USE_NSS) |
| 362 crypto::CryptoModuleBlockingPasswordDelegate* |
| 363 ShellContentBrowserClient::GetCryptoPasswordDelegate(const GURL& url) { |
| 364 return NULL; |
| 365 } |
| 366 #endif |
| 367 |
| 368 content::ShellBrowserContext* ShellContentBrowserClient::browser_context() { |
| 369 return shell_browser_main_parts_->browser_context(); |
| 370 } |
| 371 |
| 372 } // namespace examples |
| 373 } // namespace views |
OLD | NEW |