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/base_switches.h" | 8 #include "base/base_switches.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "components/signin/core/browser/signin_manager.h" | 21 #include "components/signin/core/browser/signin_manager.h" |
22 #include "content/public/browser/android/compositor.h" | 22 #include "content/public/browser/android/compositor.h" |
23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/common/main_function_params.h" | 24 #include "content/public/common/main_function_params.h" |
25 #include "media/base/android/media_client_android.h" | 25 #include "media/base/android/media_client_android.h" |
26 #include "net/android/network_change_notifier_factory_android.h" | 26 #include "net/android/network_change_notifier_factory_android.h" |
27 #include "net/base/network_change_notifier.h" | 27 #include "net/base/network_change_notifier.h" |
28 #include "ui/base/resource/resource_bundle_android.h" | 28 #include "ui/base/resource/resource_bundle_android.h" |
29 #include "ui/base/ui_base_paths.h" | 29 #include "ui/base/ui_base_paths.h" |
30 | 30 |
| 31 #if defined(USE_AURA) |
| 32 #include "ui/wm/android/window_tree_host_manager.h" |
| 33 #endif |
| 34 |
31 namespace { | 35 namespace { |
32 | 36 |
33 void DeleteFileTask( | 37 void DeleteFileTask( |
34 const base::FilePath& file_path) { | 38 const base::FilePath& file_path) { |
35 if (base::PathExists(file_path)) | 39 if (base::PathExists(file_path)) |
36 base::DeleteFile(file_path, false); | 40 base::DeleteFile(file_path, false); |
37 } | 41 } |
38 | 42 |
39 } // namespace | 43 } // namespace |
40 | 44 |
41 ChromeBrowserMainPartsAndroid::ChromeBrowserMainPartsAndroid( | 45 ChromeBrowserMainPartsAndroid::ChromeBrowserMainPartsAndroid( |
42 const content::MainFunctionParams& parameters) | 46 const content::MainFunctionParams& parameters) |
43 : ChromeBrowserMainParts(parameters) { | 47 : ChromeBrowserMainParts(parameters) { |
44 } | 48 } |
45 | 49 |
46 ChromeBrowserMainPartsAndroid::~ChromeBrowserMainPartsAndroid() { | 50 ChromeBrowserMainPartsAndroid::~ChromeBrowserMainPartsAndroid() { |
47 } | 51 } |
48 | 52 |
| 53 #if defined(USE_AURA) |
| 54 void ChromeBrowserMainPartsAndroid::InitAura() { |
| 55 window_tree_host_manager_.reset(new WindowTreeHostManager( |
| 56 gfx::Size(800, 600), content::GetContextFactory())); |
| 57 window_tree_host_manager_->host()->Show(); |
| 58 } |
| 59 #endif |
| 60 |
49 int ChromeBrowserMainPartsAndroid::PreCreateThreads() { | 61 int ChromeBrowserMainPartsAndroid::PreCreateThreads() { |
50 TRACE_EVENT0("startup", "ChromeBrowserMainPartsAndroid::PreCreateThreads") | 62 TRACE_EVENT0("startup", "ChromeBrowserMainPartsAndroid::PreCreateThreads") |
51 | 63 |
52 // The CrashDumpManager must be initialized before any child process is | 64 // The CrashDumpManager must be initialized before any child process is |
53 // created (as they need to access it during creation). Such processes | 65 // created (as they need to access it during creation). Such processes |
54 // are created on the PROCESS_LAUNCHER thread, and so the manager is | 66 // are created on the PROCESS_LAUNCHER thread, and so the manager is |
55 // initialized before that thread is created. | 67 // initialized before that thread is created. |
56 #if defined(GOOGLE_CHROME_BUILD) | 68 #if defined(GOOGLE_CHROME_BUILD) |
57 // TODO(jcivelli): we should not initialize the crash-reporter when it was not | 69 // TODO(jcivelli): we should not initialize the crash-reporter when it was not |
58 // enabled. Right now if it is disabled we still generate the minidumps but we | 70 // enabled. Right now if it is disabled we still generate the minidumps but we |
(...skipping 14 matching lines...) Expand all Loading... |
73 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dump_dir)); | 85 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dump_dir)); |
74 } | 86 } |
75 | 87 |
76 bool has_language_splits = | 88 bool has_language_splits = |
77 base::android::BuildInfo::GetInstance()->has_language_apk_splits(); | 89 base::android::BuildInfo::GetInstance()->has_language_apk_splits(); |
78 ui::SetLocalePaksStoredInApk(has_language_splits); | 90 ui::SetLocalePaksStoredInApk(has_language_splits); |
79 | 91 |
80 return ChromeBrowserMainParts::PreCreateThreads(); | 92 return ChromeBrowserMainParts::PreCreateThreads(); |
81 } | 93 } |
82 | 94 |
| 95 void ChromeBrowserMainPartsAndroid::PreProfileInit() { |
| 96 #if defined(USE_AURA) |
| 97 InitAura(); |
| 98 #endif |
| 99 ChromeBrowserMainParts::PreProfileInit(); |
| 100 } |
| 101 |
83 void ChromeBrowserMainPartsAndroid::PostProfileInit() { | 102 void ChromeBrowserMainPartsAndroid::PostProfileInit() { |
84 ChromeBrowserMainParts::PostProfileInit(); | 103 ChromeBrowserMainParts::PostProfileInit(); |
85 | 104 |
86 // Previously we stored information related to salient images for bookmarks | 105 // Previously we stored information related to salient images for bookmarks |
87 // in a local file. We replaced the salient images with favicons. As part | 106 // in a local file. We replaced the salient images with favicons. As part |
88 // of the clean up, the local file needs to be deleted. See crbug.com/499415. | 107 // of the clean up, the local file needs to be deleted. See crbug.com/499415. |
89 base::FilePath bookmark_image_file_path = profile()->GetPath().Append( | 108 base::FilePath bookmark_image_file_path = profile()->GetPath().Append( |
90 PersistentImageStore::kBookmarkImageStoreDb); | 109 PersistentImageStore::kBookmarkImageStoreDb); |
91 content::BrowserThread::PostDelayedTask( | 110 content::BrowserThread::PostDelayedTask( |
92 content::BrowserThread::FILE, FROM_HERE, | 111 content::BrowserThread::FILE, FROM_HERE, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 ChromeBrowserMainParts::PostBrowserStart(); | 152 ChromeBrowserMainParts::PostBrowserStart(); |
134 | 153 |
135 content::BrowserThread::GetBlockingPool()->PostDelayedTask(FROM_HERE, | 154 content::BrowserThread::GetBlockingPool()->PostDelayedTask(FROM_HERE, |
136 base::Bind(&SeccompSupportDetector::StartDetection), | 155 base::Bind(&SeccompSupportDetector::StartDetection), |
137 base::TimeDelta::FromMinutes(1)); | 156 base::TimeDelta::FromMinutes(1)); |
138 } | 157 } |
139 | 158 |
140 void ChromeBrowserMainPartsAndroid::ShowMissingLocaleMessageBox() { | 159 void ChromeBrowserMainPartsAndroid::ShowMissingLocaleMessageBox() { |
141 NOTREACHED(); | 160 NOTREACHED(); |
142 } | 161 } |
OLD | NEW |