Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: android_webview/browser/aw_content_browser_client.cc

Issue 12253057: Implement WebStorage API methods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 #include "android_webview/browser/aw_content_browser_client.h" 5 #include "android_webview/browser/aw_content_browser_client.h"
6 6
7 #include "android_webview/browser/aw_browser_context.h"
7 #include "android_webview/browser/aw_browser_main_parts.h" 8 #include "android_webview/browser/aw_browser_main_parts.h"
8 #include "android_webview/browser/aw_cookie_access_policy.h" 9 #include "android_webview/browser/aw_cookie_access_policy.h"
9 #include "android_webview/browser/aw_quota_permission_context.h" 10 #include "android_webview/browser/aw_quota_permission_context.h"
11 #include "android_webview/browser/jni_dependency_factory.h"
10 #include "android_webview/browser/net_disk_cache_remover.h" 12 #include "android_webview/browser/net_disk_cache_remover.h"
11 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h" 13 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h"
12 #include "android_webview/common/url_constants.h" 14 #include "android_webview/common/url_constants.h"
13 #include "base/android/locale_utils.h" 15 #include "base/android/locale_utils.h"
14 #include "base/base_paths_android.h" 16 #include "base/base_paths_android.h"
15 #include "base/path_service.h" 17 #include "base/path_service.h"
16 #include "content/public/browser/access_token_store.h" 18 #include "content/public/browser/access_token_store.h"
17 #include "content/public/browser/child_process_security_policy.h" 19 #include "content/public/browser/child_process_security_policy.h"
18 #include "content/public/browser/render_process_host.h" 20 #include "content/public/browser/render_process_host.h"
19 #include "content/public/browser/render_view_host.h" 21 #include "content/public/browser/render_view_host.h"
(...skipping 22 matching lines...) Expand all
42 private: 44 private:
43 virtual ~AwAccessTokenStore() { } 45 virtual ~AwAccessTokenStore() { }
44 46
45 DISALLOW_COPY_AND_ASSIGN(AwAccessTokenStore); 47 DISALLOW_COPY_AND_ASSIGN(AwAccessTokenStore);
46 }; 48 };
47 49
48 } 50 }
49 51
50 namespace android_webview { 52 namespace android_webview {
51 53
54 // static
55 AwContentBrowserClient* AwContentBrowserClient::FromContentBrowserClient(
56 content::ContentBrowserClient* client) {
57 return static_cast<AwContentBrowserClient*>(client);
58 }
59
52 AwContentBrowserClient::AwContentBrowserClient( 60 AwContentBrowserClient::AwContentBrowserClient(
53 ViewDelegateFactoryFn* view_delegate_factory, 61 JniDependencyFactory* native_factory)
54 GeolocationPermissionFactoryFn* geolocation_permission_factory) 62 : native_factory_(native_factory) {
55 : view_delegate_factory_(view_delegate_factory) {
56 base::FilePath user_data_dir; 63 base::FilePath user_data_dir;
57 if (!PathService::Get(base::DIR_ANDROID_APP_DATA, &user_data_dir)) { 64 if (!PathService::Get(base::DIR_ANDROID_APP_DATA, &user_data_dir)) {
58 NOTREACHED() << "Failed to get app data directory for Android WebView"; 65 NOTREACHED() << "Failed to get app data directory for Android WebView";
59 } 66 }
60 browser_context_.reset( 67 browser_context_.reset(
61 new AwBrowserContext(user_data_dir, geolocation_permission_factory)); 68 new AwBrowserContext(user_data_dir, native_factory_));
62 } 69 }
63 70
64 AwContentBrowserClient::~AwContentBrowserClient() { 71 AwContentBrowserClient::~AwContentBrowserClient() {
65 } 72 }
66 73
67 void AwContentBrowserClient::AddCertificate(net::URLRequest* request, 74 void AwContentBrowserClient::AddCertificate(net::URLRequest* request,
68 net::CertificateMimeType cert_type, 75 net::CertificateMimeType cert_type,
69 const void* cert_data, 76 const void* cert_data,
70 size_t cert_size, 77 size_t cert_size,
71 int render_process_id, 78 int render_process_id,
72 int render_view_id) { 79 int render_view_id) {
73 if (cert_size > 0) 80 if (cert_size > 0)
74 net::android::StoreCertificate(cert_type, cert_data, cert_size); 81 net::android::StoreCertificate(cert_type, cert_data, cert_size);
75 } 82 }
76 83
77 AwBrowserContext* AwContentBrowserClient::GetAwBrowserContext() { 84 AwBrowserContext* AwContentBrowserClient::GetAwBrowserContext() {
78 return browser_context_.get(); 85 return browser_context_.get();
79 } 86 }
80 87
81 content::BrowserMainParts* AwContentBrowserClient::CreateBrowserMainParts( 88 content::BrowserMainParts* AwContentBrowserClient::CreateBrowserMainParts(
82 const content::MainFunctionParams& parameters) { 89 const content::MainFunctionParams& parameters) {
83 return new AwBrowserMainParts(browser_context_.get()); 90 return new AwBrowserMainParts(browser_context_.get());
84 } 91 }
85 92
86 content::WebContentsViewDelegate* 93 content::WebContentsViewDelegate*
87 AwContentBrowserClient::GetWebContentsViewDelegate( 94 AwContentBrowserClient::GetWebContentsViewDelegate(
88 content::WebContents* web_contents) { 95 content::WebContents* web_contents) {
89 return (*view_delegate_factory_)(web_contents); 96 return native_factory_->CreateViewDelegate(web_contents);
90 } 97 }
91 98
92 void AwContentBrowserClient::RenderProcessHostCreated( 99 void AwContentBrowserClient::RenderProcessHostCreated(
93 content::RenderProcessHost* host) { 100 content::RenderProcessHost* host) {
94 // If WebView becomes multi-process capable, this may be insecure. 101 // If WebView becomes multi-process capable, this may be insecure.
95 // More benefit can be derived from the ChildProcessSecurotyPolicy by 102 // More benefit can be derived from the ChildProcessSecurotyPolicy by
96 // deferring the GrantScheme calls until we know that a given child process 103 // deferring the GrantScheme calls until we know that a given child process
97 // really does need that priviledge. Check here to ensure we rethink this 104 // really does need that priviledge. Check here to ensure we rethink this
98 // when the time comes. See crbug.com/156062. 105 // when the time comes. See crbug.com/156062.
99 CHECK(content::RenderProcessHost::run_renderer_in_process()); 106 CHECK(content::RenderProcessHost::run_renderer_in_process());
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 392
386 bool AwContentBrowserClient::AllowPepperSocketAPI( 393 bool AwContentBrowserClient::AllowPepperSocketAPI(
387 content::BrowserContext* browser_context, 394 content::BrowserContext* browser_context,
388 const GURL& url, 395 const GURL& url,
389 const content::SocketPermissionRequest& params) { 396 const content::SocketPermissionRequest& params) {
390 NOTREACHED() << "Android WebView does not support plugins"; 397 NOTREACHED() << "Android WebView does not support plugins";
391 return false; 398 return false;
392 } 399 }
393 400
394 } // namespace android_webview 401 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_content_browser_client.h ('k') | android_webview/browser/aw_quota_manager_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698