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/base_switches.h" | 7 #include "base/base_switches.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" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/task_scheduler/post_task.h" | 12 #include "base/task_scheduler/post_task.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "chrome/browser/android/mojo/chrome_interface_registrar_android.h" | 14 #include "chrome/browser/android/mojo/chrome_interface_registrar_android.h" |
15 #include "chrome/browser/android/seccomp_support_detector.h" | 15 #include "chrome/browser/android/seccomp_support_detector.h" |
| 16 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/signin/signin_manager_factory.h" | 17 #include "chrome/browser/signin/signin_manager_factory.h" |
17 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
18 #include "chrome/common/descriptors_android.h" | 19 #include "chrome/common/descriptors_android.h" |
19 #include "components/crash/content/app/breakpad_linux.h" | 20 #include "components/crash/content/app/breakpad_linux.h" |
20 #include "components/crash/content/browser/crash_dump_manager_android.h" | 21 #include "components/crash/content/browser/crash_dump_manager_android.h" |
21 #include "components/signin/core/browser/signin_manager.h" | 22 #include "components/signin/core/browser/signin_manager.h" |
22 #include "content/public/browser/android/compositor.h" | 23 #include "content/public/browser/android/compositor.h" |
23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/common/main_function_params.h" | 25 #include "content/public/common/main_function_params.h" |
25 #include "net/android/network_change_notifier_factory_android.h" | 26 #include "net/android/network_change_notifier_factory_android.h" |
26 #include "net/base/network_change_notifier.h" | 27 #include "net/base/network_change_notifier.h" |
| 28 #include "ui/base/clipboard/clipboard_android.h" |
27 #include "ui/base/resource/resource_bundle_android.h" | 29 #include "ui/base/resource/resource_bundle_android.h" |
28 #include "ui/base/ui_base_paths.h" | 30 #include "ui/base/ui_base_paths.h" |
29 | 31 |
| 32 class PrefService; |
| 33 |
30 namespace { | 34 namespace { |
31 | 35 |
32 void DeleteFileTask( | 36 void DeleteFileTask( |
33 const base::FilePath& file_path) { | 37 const base::FilePath& file_path) { |
34 if (base::PathExists(file_path)) | 38 if (base::PathExists(file_path)) |
35 base::DeleteFile(file_path, false); | 39 base::DeleteFile(file_path, false); |
36 } | 40 } |
37 | 41 |
38 } // namespace | 42 } // namespace |
39 | 43 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 94 |
91 // Previously we stored information related to salient images for bookmarks | 95 // Previously we stored information related to salient images for bookmarks |
92 // in a local file. We replaced the salient images with favicons. As part | 96 // in a local file. We replaced the salient images with favicons. As part |
93 // of the clean up, the local file needs to be deleted. See crbug.com/499415. | 97 // of the clean up, the local file needs to be deleted. See crbug.com/499415. |
94 base::FilePath bookmark_image_file_path = | 98 base::FilePath bookmark_image_file_path = |
95 profile()->GetPath().Append("BookmarkImageAndUrlStore.db"); | 99 profile()->GetPath().Append("BookmarkImageAndUrlStore.db"); |
96 content::BrowserThread::PostDelayedTask( | 100 content::BrowserThread::PostDelayedTask( |
97 content::BrowserThread::FILE, FROM_HERE, | 101 content::BrowserThread::FILE, FROM_HERE, |
98 base::Bind(&DeleteFileTask, bookmark_image_file_path), | 102 base::Bind(&DeleteFileTask, bookmark_image_file_path), |
99 base::TimeDelta::FromMinutes(1)); | 103 base::TimeDelta::FromMinutes(1)); |
| 104 |
| 105 // TODO(mpearson): Figure out if there's a better place for this. In |
| 106 // short, we want ClipboardAndroid to get a call / be notified when a |
| 107 // local_state pointer is available. |
| 108 // Tell ClipboardAndroid that a local state pointer is available. |
| 109 PrefService* local_state = g_browser_process->local_state(); |
| 110 DCHECK(local_state != nullptr); |
| 111 // Given the context, the cast is guaranteed to succeed. |
| 112 static_cast<ui::ClipboardAndroid*>(ui::Clipboard::GetForCurrentThread()) |
| 113 ->SetLocalState(local_state); |
| 114 |
100 // Start watching the preferences that need to be backed up backup using | 115 // Start watching the preferences that need to be backed up backup using |
101 // Android backup, so that we create a new backup if they change. | 116 // Android backup, so that we create a new backup if they change. |
102 backup_watcher_.reset(new chrome::android::ChromeBackupWatcher(profile())); | 117 backup_watcher_.reset(new chrome::android::ChromeBackupWatcher(profile())); |
103 } | 118 } |
104 | 119 |
105 void ChromeBrowserMainPartsAndroid::PreEarlyInitialization() { | 120 void ChromeBrowserMainPartsAndroid::PreEarlyInitialization() { |
106 TRACE_EVENT0("startup", | 121 TRACE_EVENT0("startup", |
107 "ChromeBrowserMainPartsAndroid::PreEarlyInitialization") | 122 "ChromeBrowserMainPartsAndroid::PreEarlyInitialization") |
108 net::NetworkChangeNotifier::SetFactory( | 123 net::NetworkChangeNotifier::SetFactory( |
109 new net::NetworkChangeNotifierFactoryAndroid()); | 124 new net::NetworkChangeNotifierFactoryAndroid()); |
(...skipping 28 matching lines...) Expand all Loading... |
138 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 153 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( |
139 base::TaskPriority::BACKGROUND), | 154 base::TaskPriority::BACKGROUND), |
140 base::Bind(&ReportSeccompSupport), base::TimeDelta::FromMinutes(1)); | 155 base::Bind(&ReportSeccompSupport), base::TimeDelta::FromMinutes(1)); |
141 | 156 |
142 RegisterChromeJavaMojoInterfaces(); | 157 RegisterChromeJavaMojoInterfaces(); |
143 } | 158 } |
144 | 159 |
145 void ChromeBrowserMainPartsAndroid::ShowMissingLocaleMessageBox() { | 160 void ChromeBrowserMainPartsAndroid::ShowMissingLocaleMessageBox() { |
146 NOTREACHED(); | 161 NOTREACHED(); |
147 } | 162 } |
OLD | NEW |