OLD | NEW |
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/app/android/content_main.h" | 5 #include "content/app/android/content_main.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "content/app/android/user_agent.h" | |
12 #include "content/public/app/content_main_delegate.h" | 11 #include "content/public/app/content_main_delegate.h" |
13 #include "content/public/app/content_main_runner.h" | 12 #include "content/public/app/content_main_runner.h" |
14 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
15 #include "jni/ContentMain_jni.h" | 14 #include "jni/ContentMain_jni.h" |
16 #include "webkit/glue/user_agent.h" | 15 #include "webkit/glue/user_agent.h" |
17 | 16 |
18 using base::LazyInstance; | 17 using base::LazyInstance; |
19 using content::ContentMainRunner; | 18 using content::ContentMainRunner; |
20 using content::ContentMainDelegate; | 19 using content::ContentMainDelegate; |
21 | 20 |
(...skipping 18 matching lines...) Expand all Loading... |
40 | 39 |
41 // This is only for browser process. We want to start waiting as early as | 40 // This is only for browser process. We want to start waiting as early as |
42 // possible though here is the common initialization code. | 41 // possible though here is the common initialization code. |
43 if (parsed_command_line.HasSwitch(switches::kWaitForDebugger) && | 42 if (parsed_command_line.HasSwitch(switches::kWaitForDebugger) && |
44 "" == parsed_command_line.GetSwitchValueASCII(switches::kProcessType)) { | 43 "" == parsed_command_line.GetSwitchValueASCII(switches::kProcessType)) { |
45 LOG(ERROR) << "Browser waiting for GDB because flag " | 44 LOG(ERROR) << "Browser waiting for GDB because flag " |
46 << switches::kWaitForDebugger << " was supplied."; | 45 << switches::kWaitForDebugger << " was supplied."; |
47 base::debug::WaitForDebugger(24*60*60, false); | 46 base::debug::WaitForDebugger(24*60*60, false); |
48 } | 47 } |
49 | 48 |
50 webkit_glue::SetUserAgentOSInfo(content::GetUserAgentOSInfo()); | |
51 | |
52 DCHECK(!g_content_runner.Get().get()); | 49 DCHECK(!g_content_runner.Get().get()); |
53 g_content_runner.Get().reset(ContentMainRunner::Create()); | 50 g_content_runner.Get().reset(ContentMainRunner::Create()); |
54 g_content_runner.Get()->Initialize(0, NULL, | 51 g_content_runner.Get()->Initialize(0, NULL, |
55 g_content_main_delegate.Get().get()); | 52 g_content_main_delegate.Get().get()); |
56 return g_content_runner.Get()->Run(); | 53 return g_content_runner.Get()->Run(); |
57 } | 54 } |
58 | 55 |
59 void SetContentMainDelegate(ContentMainDelegate* delegate) { | 56 void SetContentMainDelegate(ContentMainDelegate* delegate) { |
60 DCHECK(!g_content_main_delegate.Get().get()); | 57 DCHECK(!g_content_main_delegate.Get().get()); |
61 g_content_main_delegate.Get().reset(delegate); | 58 g_content_main_delegate.Get().reset(delegate); |
62 } | 59 } |
63 | 60 |
64 bool RegisterContentMain(JNIEnv* env) { | 61 bool RegisterContentMain(JNIEnv* env) { |
65 return RegisterNativesImpl(env); | 62 return RegisterNativesImpl(env); |
66 } | 63 } |
67 | 64 |
68 } // namespace content | 65 } // namespace content |
OLD | NEW |