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

Side by Side Diff: android_webview/lib/aw_browser_dependency_factory_impl.cc

Issue 10916309: [Android] Remove the dependency on TabContents. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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
« no previous file with comments | « android_webview/lib/DEPS ('k') | no next file » | 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/lib/aw_browser_dependency_factory_impl.h" 5 #include "android_webview/lib/aw_browser_dependency_factory_impl.h"
6 6
7 // TODO(joth): Componentize or remove chrome/... dependencies. 7 // TODO(joth): Componentize or remove chrome/... dependencies.
8 #include "android_webview/browser/net/aw_network_delegate.h" 8 #include "android_webview/browser/net/aw_network_delegate.h"
9 #include "android_webview/native/aw_contents_container.h" 9 #include "android_webview/native/aw_contents_container.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_manager.h" 16 #include "chrome/browser/profiles/profile_manager.h"
17 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_creator.h" 17 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_creator.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents.h"
19 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
20 #include "ipc/ipc_message.h" 19 #include "ipc/ipc_message.h"
21 #include "net/url_request/url_request_context.h" 20 #include "net/url_request/url_request_context.h"
22 #include "net/url_request/url_request_context_getter.h" 21 #include "net/url_request/url_request_context_getter.h"
23 22
24 using content::BrowserContext; 23 using content::BrowserContext;
25 using content::WebContents; 24 using content::WebContents;
26 25
27 namespace android_webview { 26 namespace android_webview {
28 27
29 namespace { 28 namespace {
30 29
31 base::LazyInstance<AwBrowserDependencyFactoryImpl>::Leaky g_lazy_instance; 30 base::LazyInstance<AwBrowserDependencyFactoryImpl>::Leaky g_lazy_instance;
32 31
33 class TabContentsWrapper : public AwContentsContainer { 32 class WebContentsWrapper : public AwContentsContainer {
34 public: 33 public:
35 TabContentsWrapper(TabContents* tab_contents) { 34 WebContentsWrapper(WebContents* web_contents)
36 tab_contents_.reset(tab_contents); 35 : web_contents_(web_contents) {
37 } 36 }
38 37
39 virtual ~TabContentsWrapper() {} 38 virtual ~WebContentsWrapper() {}
40 39
41 // AwContentsContainer 40 // AwContentsContainer
42 virtual content::WebContents* GetWebContents() OVERRIDE { 41 virtual content::WebContents* GetWebContents() OVERRIDE {
43 return tab_contents_->web_contents(); 42 return web_contents_.get();
44 } 43 }
45 44
46 private: 45 private:
47 scoped_ptr<TabContents> tab_contents_; 46 scoped_ptr<content::WebContents> web_contents_;
48 }; 47 };
49 48
50 } // namespace 49 } // namespace
51 50
52 AwBrowserDependencyFactoryImpl::AwBrowserDependencyFactoryImpl() {} 51 AwBrowserDependencyFactoryImpl::AwBrowserDependencyFactoryImpl() {}
53 52
54 AwBrowserDependencyFactoryImpl::~AwBrowserDependencyFactoryImpl() {} 53 AwBrowserDependencyFactoryImpl::~AwBrowserDependencyFactoryImpl() {}
55 54
56 // static 55 // static
57 void AwBrowserDependencyFactoryImpl::InstallInstance() { 56 void AwBrowserDependencyFactoryImpl::InstallInstance() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 return incognito ? profile->GetOffTheRecordProfile() : profile; 92 return incognito ? profile->GetOffTheRecordProfile() : profile;
94 } 93 }
95 94
96 WebContents* AwBrowserDependencyFactoryImpl::CreateWebContents(bool incognito) { 95 WebContents* AwBrowserDependencyFactoryImpl::CreateWebContents(bool incognito) {
97 return content::WebContents::Create( 96 return content::WebContents::Create(
98 GetBrowserContext(incognito), 0, MSG_ROUTING_NONE, 0); 97 GetBrowserContext(incognito), 0, MSG_ROUTING_NONE, 0);
99 } 98 }
100 99
101 AwContentsContainer* AwBrowserDependencyFactoryImpl::CreateContentsContainer( 100 AwContentsContainer* AwBrowserDependencyFactoryImpl::CreateContentsContainer(
102 content::WebContents* contents) { 101 content::WebContents* contents) {
103 return new TabContentsWrapper( 102 return new WebContentsWrapper(contents);
104 TabContents::Factory::CreateTabContents(contents));
Avi (use Gerrit) 2012/09/14 20:36:00 Thank you. Please remove the friend declaration fr
105 } 103 }
106 104
107 content::JavaScriptDialogCreator* 105 content::JavaScriptDialogCreator*
108 AwBrowserDependencyFactoryImpl::GetJavaScriptDialogCreator() { 106 AwBrowserDependencyFactoryImpl::GetJavaScriptDialogCreator() {
109 return GetJavaScriptDialogCreatorInstance(); 107 return GetJavaScriptDialogCreatorInstance();
110 } 108 }
111 109
112 } // namespace android_webview 110 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/lib/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698