Chromium Code Reviews| 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/memory/ptr_util.h" | |
| 11 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 12 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 13 #include "chrome/browser/android/mojo/chrome_interface_registrar_android.h" | 14 #include "chrome/browser/android/mojo/chrome_interface_registrar_android.h" |
| 14 #include "chrome/browser/android/seccomp_support_detector.h" | 15 #include "chrome/browser/android/seccomp_support_detector.h" |
| 15 #include "chrome/browser/signin/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
| 16 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/descriptors_android.h" | |
| 17 #include "components/crash/content/app/breakpad_linux.h" | 19 #include "components/crash/content/app/breakpad_linux.h" |
| 18 #include "components/crash/content/browser/crash_dump_manager_android.h" | 20 #include "components/crash/content/browser/crash_dump_manager_android.h" |
| 19 #include "components/signin/core/browser/signin_manager.h" | 21 #include "components/signin/core/browser/signin_manager.h" |
| 20 #include "content/public/browser/android/compositor.h" | 22 #include "content/public/browser/android/compositor.h" |
| 21 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/common/main_function_params.h" | 24 #include "content/public/common/main_function_params.h" |
| 23 #include "net/android/network_change_notifier_factory_android.h" | 25 #include "net/android/network_change_notifier_factory_android.h" |
| 24 #include "net/base/network_change_notifier.h" | 26 #include "net/base/network_change_notifier.h" |
| 25 #include "ui/base/resource/resource_bundle_android.h" | 27 #include "ui/base/resource/resource_bundle_android.h" |
| 26 #include "ui/base/ui_base_paths.h" | 28 #include "ui/base/ui_base_paths.h" |
| 27 | 29 |
| 28 namespace { | 30 namespace { |
| 29 | 31 |
| 30 void DeleteFileTask( | 32 void DeleteFileTask( |
| 31 const base::FilePath& file_path) { | 33 const base::FilePath& file_path) { |
| 32 if (base::PathExists(file_path)) | 34 if (base::PathExists(file_path)) |
| 33 base::DeleteFile(file_path, false); | 35 base::DeleteFile(file_path, false); |
| 34 } | 36 } |
| 35 | 37 |
| 36 } // namespace | 38 } // namespace |
| 37 | 39 |
| 38 ChromeBrowserMainPartsAndroid::ChromeBrowserMainPartsAndroid( | 40 ChromeBrowserMainPartsAndroid::ChromeBrowserMainPartsAndroid( |
| 39 const content::MainFunctionParams& parameters) | 41 const content::MainFunctionParams& parameters) |
| 40 : ChromeBrowserMainParts(parameters) { | 42 : ChromeBrowserMainParts(parameters) { |
| 41 } | 43 } |
| 42 | 44 |
| 43 ChromeBrowserMainPartsAndroid::~ChromeBrowserMainPartsAndroid() { | 45 ChromeBrowserMainPartsAndroid::~ChromeBrowserMainPartsAndroid() { |
| 46 breakpad::CrashDumpObserver::GetInstance()->UnregisterClient( | |
| 47 crash_dump_manager_); | |
| 44 } | 48 } |
| 45 | 49 |
| 46 int ChromeBrowserMainPartsAndroid::PreCreateThreads() { | 50 int ChromeBrowserMainPartsAndroid::PreCreateThreads() { |
| 47 TRACE_EVENT0("startup", "ChromeBrowserMainPartsAndroid::PreCreateThreads") | 51 TRACE_EVENT0("startup", "ChromeBrowserMainPartsAndroid::PreCreateThreads") |
| 48 | 52 |
| 49 // The CrashDumpManager must be initialized before any child process is | 53 // The CrashDumpManager must be registered before any child process is |
| 50 // created (as they need to access it during creation). Such processes | 54 // created (as it needs to be notified during child process |
| 51 // are created on the PROCESS_LAUNCHER thread, and so the manager is | 55 // creation). Such processes are created on the PROCESS_LAUNCHER |
| 52 // initialized before that thread is created. | 56 // thread, and so the observer is initialized and the manager |
| 57 // registered before that thread is created. | |
| 58 breakpad::CrashDumpObserver::Create(); | |
| 59 | |
| 53 #if defined(GOOGLE_CHROME_BUILD) | 60 #if defined(GOOGLE_CHROME_BUILD) |
| 54 // TODO(jcivelli): we should not initialize the crash-reporter when it was not | 61 // TODO(jcivelli): we should not initialize the crash-reporter when it was not |
| 55 // enabled. Right now if it is disabled we still generate the minidumps but we | 62 // enabled. Right now if it is disabled we still generate the minidumps but we |
| 56 // do not upload them. | 63 // do not upload them. |
| 57 bool breakpad_enabled = true; | 64 bool breakpad_enabled = true; |
| 58 #else | 65 #else |
| 59 bool breakpad_enabled = false; | 66 bool breakpad_enabled = false; |
| 60 #endif | 67 #endif |
| 61 | 68 |
| 62 // Allow Breakpad to be enabled in Chromium builds for testing purposes. | 69 // Allow Breakpad to be enabled in Chromium builds for testing purposes. |
| 63 if (!breakpad_enabled) | 70 if (!breakpad_enabled) |
| 64 breakpad_enabled = base::CommandLine::ForCurrentProcess()->HasSwitch( | 71 breakpad_enabled = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 65 switches::kEnableCrashReporterForTesting); | 72 switches::kEnableCrashReporterForTesting); |
| 66 | 73 |
| 67 if (breakpad_enabled) { | 74 if (breakpad_enabled) { |
| 68 base::FilePath crash_dump_dir; | 75 base::FilePath crash_dump_dir; |
| 69 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_dir); | 76 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_dir); |
| 70 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dump_dir)); | 77 breakpad::CrashDumpObserver::GetInstance()->RegisterClient( |
| 78 crash_dump_manager_ = new breakpad::CrashDumpManager( | |
|
boliu
2016/10/13 21:07:18
ditto
Tobias Sargeant
2016/12/08 16:41:41
Done.
| |
| 79 crash_dump_dir, kAndroidMinidumpDescriptor)); | |
| 71 } | 80 } |
| 72 | 81 |
| 73 ui::SetLocalePaksStoredInApk(false); | 82 ui::SetLocalePaksStoredInApk(false); |
| 74 | 83 |
| 75 return ChromeBrowserMainParts::PreCreateThreads(); | 84 return ChromeBrowserMainParts::PreCreateThreads(); |
| 76 } | 85 } |
| 77 | 86 |
| 78 void ChromeBrowserMainPartsAndroid::PostProfileInit() { | 87 void ChromeBrowserMainPartsAndroid::PostProfileInit() { |
| 79 ChromeBrowserMainParts::PostProfileInit(); | 88 ChromeBrowserMainParts::PostProfileInit(); |
| 80 | 89 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 content::BrowserThread::GetBlockingPool()->PostDelayedTask(FROM_HERE, | 133 content::BrowserThread::GetBlockingPool()->PostDelayedTask(FROM_HERE, |
| 125 base::Bind(&SeccompSupportDetector::StartDetection), | 134 base::Bind(&SeccompSupportDetector::StartDetection), |
| 126 base::TimeDelta::FromMinutes(1)); | 135 base::TimeDelta::FromMinutes(1)); |
| 127 | 136 |
| 128 RegisterChromeJavaMojoInterfaces(); | 137 RegisterChromeJavaMojoInterfaces(); |
| 129 } | 138 } |
| 130 | 139 |
| 131 void ChromeBrowserMainPartsAndroid::ShowMissingLocaleMessageBox() { | 140 void ChromeBrowserMainPartsAndroid::ShowMissingLocaleMessageBox() { |
| 132 NOTREACHED(); | 141 NOTREACHED(); |
| 133 } | 142 } |
| OLD | NEW |