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

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

Issue 99683006: [Android WebView] Only send extra headers for the main page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bulach's comments addressed Created 7 years 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
« no previous file with comments | « android_webview/android_webview.gyp ('k') | android_webview/browser/aw_resource_context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_browser_context.h" 5 #include "android_webview/browser/aw_browser_context.h"
6 6
7 #include "android_webview/browser/aw_form_database_service.h" 7 #include "android_webview/browser/aw_form_database_service.h"
8 #include "android_webview/browser/aw_pref_store.h" 8 #include "android_webview/browser/aw_pref_store.h"
9 #include "android_webview/browser/aw_quota_manager_bridge.h" 9 #include "android_webview/browser/aw_quota_manager_bridge.h"
10 #include "android_webview/browser/aw_resource_context.h"
10 #include "android_webview/browser/jni_dependency_factory.h" 11 #include "android_webview/browser/jni_dependency_factory.h"
11 #include "android_webview/browser/net/aw_url_request_context_getter.h" 12 #include "android_webview/browser/net/aw_url_request_context_getter.h"
12 #include "android_webview/browser/net/init_native_callback.h" 13 #include "android_webview/browser/net/init_native_callback.h"
13 #include "base/prefs/pref_registry_simple.h" 14 #include "base/prefs/pref_registry_simple.h"
14 #include "base/prefs/pref_service.h" 15 #include "base/prefs/pref_service.h"
15 #include "base/prefs/pref_service_factory.h" 16 #include "base/prefs/pref_service_factory.h"
16 #include "components/autofill/core/common/autofill_pref_names.h" 17 #include "components/autofill/core/common/autofill_pref_names.h"
17 #include "components/user_prefs/user_prefs.h" 18 #include "components/user_prefs/user_prefs.h"
18 #include "components/visitedlink/browser/visitedlink_master.h" 19 #include "components/visitedlink/browser/visitedlink_master.h"
19 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/resource_context.h"
21 #include "content/public/browser/storage_partition.h" 21 #include "content/public/browser/storage_partition.h"
22 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
23 #include "net/cookies/cookie_store.h" 23 #include "net/cookies/cookie_store.h"
24 #include "net/url_request/url_request_context.h"
25 24
26 using base::FilePath; 25 using base::FilePath;
27 using content::BrowserThread; 26 using content::BrowserThread;
28 27
29 namespace android_webview { 28 namespace android_webview {
30 29
31 namespace { 30 namespace {
32 31
33 // Shows notifications which correspond to PersistentPrefStore's reading errors. 32 // Shows notifications which correspond to PersistentPrefStore's reading errors.
34 void HandleReadError(PersistentPrefStore::PrefReadError error) { 33 void HandleReadError(PersistentPrefStore::PrefReadError error) {
35 } 34 }
36 35
37 class AwResourceContext : public content::ResourceContext {
38 public:
39 explicit AwResourceContext(net::URLRequestContextGetter* getter)
40 : getter_(getter) {
41 DCHECK(getter_);
42 }
43 virtual ~AwResourceContext() {}
44
45 // content::ResourceContext implementation.
46 virtual net::HostResolver* GetHostResolver() OVERRIDE {
47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
48 return getter_->GetURLRequestContext()->host_resolver();
49 }
50 virtual net::URLRequestContext* GetRequestContext() OVERRIDE {
51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
52 return getter_->GetURLRequestContext();
53 }
54 virtual bool AllowMicAccess(const GURL& origin) OVERRIDE {
55 return false;
56 }
57 virtual bool AllowCameraAccess(const GURL& origin) OVERRIDE {
58 return false;
59 }
60
61 private:
62 net::URLRequestContextGetter* getter_;
63
64 DISALLOW_COPY_AND_ASSIGN(AwResourceContext);
65 };
66
67 AwBrowserContext* g_browser_context = NULL; 36 AwBrowserContext* g_browser_context = NULL;
68 37
69 } // namespace 38 } // namespace
70 39
71 AwBrowserContext::AwBrowserContext( 40 AwBrowserContext::AwBrowserContext(
72 const FilePath path, 41 const FilePath path,
73 JniDependencyFactory* native_factory) 42 JniDependencyFactory* native_factory)
74 : context_storage_path_(path), 43 : context_storage_path_(path),
75 native_factory_(native_factory) { 44 native_factory_(native_factory) {
76 DCHECK(g_browser_context == NULL); 45 DCHECK(g_browser_context == NULL);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 226
258 void AwBrowserContext::RebuildTable( 227 void AwBrowserContext::RebuildTable(
259 const scoped_refptr<URLEnumerator>& enumerator) { 228 const scoped_refptr<URLEnumerator>& enumerator) {
260 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client 229 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client
261 // can change in the lifetime of this WebView and may not yet be set here. 230 // can change in the lifetime of this WebView and may not yet be set here.
262 // Therefore this initialization path is not used. 231 // Therefore this initialization path is not used.
263 enumerator->OnComplete(true); 232 enumerator->OnComplete(true);
264 } 233 }
265 234
266 } // namespace android_webview 235 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/android_webview.gyp ('k') | android_webview/browser/aw_resource_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698