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

Side by Side Diff: content/shell/shell_browser_main_parts.cc

Issue 10928193: Add native-side unit test for Android NetworkChangeNotifier (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressing benm's comments 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
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 "content/shell/shell_browser_main_parts.h" 5 #include "content/shell/shell_browser_main_parts.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "base/threading/thread_restrictions.h" 12 #include "base/threading/thread_restrictions.h"
13 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
14 #include "content/public/common/main_function_params.h" 14 #include "content/public/common/main_function_params.h"
15 #include "content/public/common/url_constants.h" 15 #include "content/public/common/url_constants.h"
16 #include "content/shell/shell.h" 16 #include "content/shell/shell.h"
17 #include "content/shell/shell_browser_context.h" 17 #include "content/shell/shell_browser_context.h"
18 #include "content/shell/shell_devtools_delegate.h" 18 #include "content/shell/shell_devtools_delegate.h"
19 #include "content/shell/shell_switches.h" 19 #include "content/shell/shell_switches.h"
20 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
21 #include "grit/net_resources.h" 21 #include "grit/net_resources.h"
22 #include "net/base/net_module.h" 22 #include "net/base/net_module.h"
23 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
24 24
25 #if defined(OS_ANDROID) 25 #if defined(OS_ANDROID)
26 #include "net/base/network_change_notifier.h" 26 #include "net/base/network_change_notifier.h"
27 #include "net/android/network_change_notifier_factory.h" 27 #include "net/android/network_change_notifier_factory_android.h"
28 #endif 28 #endif
29 29
30 namespace content { 30 namespace content {
31 31
32 namespace { 32 namespace {
33 33
34 static GURL GetStartupURL() { 34 static GURL GetStartupURL() {
35 CommandLine* command_line = CommandLine::ForCurrentProcess(); 35 CommandLine* command_line = CommandLine::ForCurrentProcess();
36 if (command_line->HasSwitch(switches::kContentBrowserTest)) 36 if (command_line->HasSwitch(switches::kContentBrowserTest))
37 return GURL(); 37 return GURL();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 void ShellBrowserMainParts::PostMainMessageLoopStart() { 79 void ShellBrowserMainParts::PostMainMessageLoopStart() {
80 #if defined(OS_ANDROID) 80 #if defined(OS_ANDROID)
81 MessageLoopForUI::current()->Start(); 81 MessageLoopForUI::current()->Start();
82 #endif 82 #endif
83 } 83 }
84 84
85 void ShellBrowserMainParts::PreEarlyInitialization() { 85 void ShellBrowserMainParts::PreEarlyInitialization() {
86 #if defined(OS_ANDROID) 86 #if defined(OS_ANDROID)
87 net::NetworkChangeNotifier::SetFactory( 87 net::NetworkChangeNotifier::SetFactory(
88 new net::android::NetworkChangeNotifierFactory()); 88 new net::NetworkChangeNotifierFactoryAndroid());
jochen (gone - plz use gerrit) 2012/09/18 13:25:43 why is this needed? ShellBrowserMainPartsAndroid
gone 2012/09/18 17:05:46 AFAICT, there is no ShellBrowserMainPartsAndroid i
jochen (gone - plz use gerrit) 2012/09/18 19:21:05 Argh, I misread ChromeBrowserMainPartsAndroid as S
89 #endif 89 #endif
90 } 90 }
91 91
92 void ShellBrowserMainParts::PreMainMessageLoopRun() { 92 void ShellBrowserMainParts::PreMainMessageLoopRun() {
93 browser_context_.reset(new ShellBrowserContext(false)); 93 browser_context_.reset(new ShellBrowserContext(false));
94 off_the_record_browser_context_.reset(new ShellBrowserContext(true)); 94 off_the_record_browser_context_.reset(new ShellBrowserContext(true));
95 95
96 Shell::PlatformInitialize(); 96 Shell::PlatformInitialize();
97 net::NetModule::SetResourceProvider(PlatformResourceProvider); 97 net::NetModule::SetResourceProvider(PlatformResourceProvider);
98 98
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 #if defined(USE_AURA) 140 #if defined(USE_AURA)
141 Shell::PlatformExit(); 141 Shell::PlatformExit();
142 #endif 142 #endif
143 if (devtools_delegate_) 143 if (devtools_delegate_)
144 devtools_delegate_->Stop(); 144 devtools_delegate_->Stop();
145 browser_context_.reset(); 145 browser_context_.reset();
146 off_the_record_browser_context_.reset(); 146 off_the_record_browser_context_.reset();
147 } 147 }
148 148
149 } // namespace 149 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698