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 "chrome/browser/chrome_browser_main_android.h" | 5 #include "chrome/browser/chrome_browser_main_android.h" |
6 | 6 |
7 #include "base/android/build_info.h" | 7 #include "base/android/build_info.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "components/signin/core/browser/signin_manager.h" | 22 #include "components/signin/core/browser/signin_manager.h" |
23 #include "content/public/browser/android/compositor.h" | 23 #include "content/public/browser/android/compositor.h" |
24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/common/main_function_params.h" | 25 #include "content/public/common/main_function_params.h" |
26 #include "media/base/android/media_client_android.h" | 26 #include "media/base/android/media_client_android.h" |
27 #include "net/android/network_change_notifier_factory_android.h" | 27 #include "net/android/network_change_notifier_factory_android.h" |
28 #include "net/base/network_change_notifier.h" | 28 #include "net/base/network_change_notifier.h" |
29 #include "ui/base/resource/resource_bundle_android.h" | 29 #include "ui/base/resource/resource_bundle_android.h" |
30 #include "ui/base/ui_base_paths.h" | 30 #include "ui/base/ui_base_paths.h" |
31 | 31 |
| 32 #if defined(USE_AURA) |
| 33 #include "content/public/browser/context_factory.h" |
| 34 #include "ui/wm/test/wm_test_helper.h" |
| 35 #endif |
| 36 |
32 namespace { | 37 namespace { |
33 | 38 |
34 void DeleteFileTask( | 39 void DeleteFileTask( |
35 const base::FilePath& file_path) { | 40 const base::FilePath& file_path) { |
36 if (base::PathExists(file_path)) | 41 if (base::PathExists(file_path)) |
37 base::DeleteFile(file_path, false); | 42 base::DeleteFile(file_path, false); |
38 } | 43 } |
39 | 44 |
40 } // namespace | 45 } // namespace |
41 | 46 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dump_dir)); | 79 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dump_dir)); |
75 } | 80 } |
76 | 81 |
77 bool has_language_splits = | 82 bool has_language_splits = |
78 base::android::BuildInfo::GetInstance()->has_language_apk_splits(); | 83 base::android::BuildInfo::GetInstance()->has_language_apk_splits(); |
79 ui::SetLocalePaksStoredInApk(has_language_splits); | 84 ui::SetLocalePaksStoredInApk(has_language_splits); |
80 | 85 |
81 return ChromeBrowserMainParts::PreCreateThreads(); | 86 return ChromeBrowserMainParts::PreCreateThreads(); |
82 } | 87 } |
83 | 88 |
| 89 #if defined(USE_AURA) |
| 90 void ChromeBrowserMainPartsAndroid::InitAndroidAura() { |
| 91 wm_test_helper_.reset(new wm::WMTestHelper( |
| 92 gfx::Size(800, 600), |
| 93 content::GetContextFactory())); |
| 94 wm_test_helper_->host()->Show(); |
| 95 } |
| 96 #endif |
| 97 |
| 98 void ChromeBrowserMainPartsAndroid::PreProfileInit() { |
| 99 #if defined(USE_AURA) |
| 100 InitAndroidAura(); |
| 101 #endif |
| 102 |
| 103 ChromeBrowserMainParts::PreProfileInit(); |
| 104 |
| 105 } |
| 106 |
84 void ChromeBrowserMainPartsAndroid::PostProfileInit() { | 107 void ChromeBrowserMainPartsAndroid::PostProfileInit() { |
85 Profile* main_profile = profile(); | 108 Profile* main_profile = profile(); |
86 search_counter_.reset(new GoogleSearchCounterAndroid(main_profile)); | 109 search_counter_.reset(new GoogleSearchCounterAndroid(main_profile)); |
87 | 110 |
88 ChromeBrowserMainParts::PostProfileInit(); | 111 ChromeBrowserMainParts::PostProfileInit(); |
89 | 112 |
90 // Previously we stored information related to salient images for bookmarks | 113 // Previously we stored information related to salient images for bookmarks |
91 // in a local file. We replaced the salient images with favicons. As part | 114 // in a local file. We replaced the salient images with favicons. As part |
92 // of the clean up, the local file needs to be deleted. See crbug.com/499415. | 115 // of the clean up, the local file needs to be deleted. See crbug.com/499415. |
93 base::FilePath bookmark_image_file_path = main_profile->GetPath().Append( | 116 base::FilePath bookmark_image_file_path = main_profile->GetPath().Append( |
94 PersistentImageStore::kBookmarkImageStoreDb); | 117 PersistentImageStore::kBookmarkImageStoreDb); |
95 content::BrowserThread::PostDelayedTask( | 118 content::BrowserThread::PostDelayedTask( |
96 content::BrowserThread::FILE, FROM_HERE, | 119 content::BrowserThread::FILE, FROM_HERE, |
97 base::Bind(&DeleteFileTask, | 120 base::Bind(&DeleteFileTask, |
98 bookmark_image_file_path), | 121 bookmark_image_file_path), |
99 base::TimeDelta::FromMinutes(1)); | 122 base::TimeDelta::FromMinutes(1)); |
100 } | 123 } |
101 | 124 |
102 void ChromeBrowserMainPartsAndroid::PreEarlyInitialization() { | 125 void ChromeBrowserMainPartsAndroid::PreEarlyInitialization() { |
103 TRACE_EVENT0("startup", | 126 TRACE_EVENT0("startup", |
104 "ChromeBrowserMainPartsAndroid::PreEarlyInitialization") | 127 "ChromeBrowserMainPartsAndroid::PreEarlyInitialization") |
105 net::NetworkChangeNotifier::SetFactory( | 128 net::NetworkChangeNotifier::SetFactory( |
106 new net::NetworkChangeNotifierFactoryAndroid()); | 129 new net::NetworkChangeNotifierFactoryAndroid()); |
107 | 130 |
| 131 #if !defined(USE_AURA) |
108 content::Compositor::Initialize(); | 132 content::Compositor::Initialize(); |
| 133 #endif |
109 | 134 |
110 // Chrome on Android does not use default MessageLoop. It has its own | 135 // Chrome on Android does not use default MessageLoop. It has its own |
111 // Android specific MessageLoop. | 136 // Android specific MessageLoop. |
112 DCHECK(!main_message_loop_.get()); | 137 DCHECK(!main_message_loop_.get()); |
113 | 138 |
114 // Create and start the MessageLoop. | 139 // Create and start the MessageLoop. |
115 // This is a critical point in the startup process. | 140 // This is a critical point in the startup process. |
116 { | 141 { |
117 TRACE_EVENT0("startup", | 142 TRACE_EVENT0("startup", |
118 "ChromeBrowserMainPartsAndroid::PreEarlyInitialization:CreateUiMsgLoop"); | 143 "ChromeBrowserMainPartsAndroid::PreEarlyInitialization:CreateUiMsgLoop"); |
(...skipping 19 matching lines...) Expand all Loading... |
138 ChromeBrowserMainParts::PostBrowserStart(); | 163 ChromeBrowserMainParts::PostBrowserStart(); |
139 | 164 |
140 content::BrowserThread::GetBlockingPool()->PostDelayedTask(FROM_HERE, | 165 content::BrowserThread::GetBlockingPool()->PostDelayedTask(FROM_HERE, |
141 base::Bind(&SeccompSupportDetector::StartDetection), | 166 base::Bind(&SeccompSupportDetector::StartDetection), |
142 base::TimeDelta::FromMinutes(1)); | 167 base::TimeDelta::FromMinutes(1)); |
143 } | 168 } |
144 | 169 |
145 void ChromeBrowserMainPartsAndroid::ShowMissingLocaleMessageBox() { | 170 void ChromeBrowserMainPartsAndroid::ShowMissingLocaleMessageBox() { |
146 NOTREACHED(); | 171 NOTREACHED(); |
147 } | 172 } |
OLD | NEW |