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

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

Issue 10855171: Add a test runner for android_webview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address feedback Created 8 years, 4 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
(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 "android_webview/lib/aw_browser_dependency_factory_impl.h"
6
7 // TODO(joth): Componentize or remove chrome/... dependencies.
8 #include "android_webview/native/aw_contents_container.h"
9 #include "base/lazy_instance.h"
10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_creator.h"
14 #include "chrome/browser/ui/tab_contents/tab_contents.h"
15 #include "content/public/browser/web_contents.h"
16 #include "ipc/ipc_message.h"
17
18 namespace android_webview {
19
20 namespace {
21
22 base::LazyInstance<AwBrowserDependencyFactoryImpl>::Leaky g_lazy_instance;
23
24 class TabContentsWrapper : public AwContentsContainer {
25 public:
26 TabContentsWrapper(content::WebContents* web_contents)
27 : tab_contents_(web_contents) {}
28 virtual ~TabContentsWrapper() {}
29
30 // AwContentsContainer
31 virtual content::WebContents* GetWebContents() OVERRIDE {
32 return tab_contents_.web_contents();
33 }
34
35 private:
36 TabContents tab_contents_;
37 };
38
39 } // namespace
40
41 AwBrowserDependencyFactoryImpl::AwBrowserDependencyFactoryImpl() {}
42
43 AwBrowserDependencyFactoryImpl::~AwBrowserDependencyFactoryImpl() {}
44
45 // static
46 void AwBrowserDependencyFactoryImpl::InstallInstance() {
47 SetInstance(g_lazy_instance.Pointer());
48 }
49
50 content::WebContents*
51 AwBrowserDependencyFactoryImpl::CreateWebContents(bool incognito) {
52 Profile* profile = g_browser_process->profile_manager()->GetDefaultProfile();
53 if (incognito)
54 profile = profile->GetOffTheRecordProfile();
55
56 return content::WebContents::Create(profile, 0, MSG_ROUTING_NONE, 0);
57 }
58
59 AwContentsContainer* AwBrowserDependencyFactoryImpl::CreateContentsContainer(
60 content::WebContents* contents) {
61 return new TabContentsWrapper(contents);
62 }
63
64 content::JavaScriptDialogCreator*
65 AwBrowserDependencyFactoryImpl::GetJavaScriptDialogCreator() {
66 return GetJavaScriptDialogCreatorInstance();
67 }
68
69 } // namespace android_webview
70
OLDNEW
« no previous file with comments | « android_webview/lib/aw_browser_dependency_factory_impl.h ('k') | android_webview/lib/aw_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698