[safe-browsing] Database full hash matches like prefix match.
[chromium-blink-merge.git] / chrome / browser / chrome_browser_main_android.cc
blob0098f4b56b0c9fce5513217b4992638d40b21955
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
3 // found in the LICENSE file.
5 #include "chrome/browser/chrome_browser_main_android.h"
7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h"
9 #include "base/path_service.h"
10 #include "chrome/common/chrome_paths.h"
11 #include "chrome/common/chrome_switches.h"
12 #include "components/breakpad/app/breakpad_linux.h"
13 #include "components/breakpad/browser/crash_dump_manager_android.h"
14 #include "content/public/browser/android/compositor.h"
15 #include "content/public/common/main_function_params.h"
16 #include "net/android/network_change_notifier_factory_android.h"
17 #include "net/base/network_change_notifier.h"
18 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/base/ui_base_paths.h"
21 ChromeBrowserMainPartsAndroid::ChromeBrowserMainPartsAndroid(
22 const content::MainFunctionParams& parameters)
23 : ChromeBrowserMainParts(parameters) {
26 ChromeBrowserMainPartsAndroid::~ChromeBrowserMainPartsAndroid() {
29 void ChromeBrowserMainPartsAndroid::PreProfileInit() {
30 TRACE_EVENT0("startup", "ChromeBrowserMainPartsAndroid::PreProfileInit")
31 #if defined(GOOGLE_CHROME_BUILD)
32 // TODO(jcivelli): we should not initialize the crash-reporter when it was not
33 // enabled. Right now if it is disabled we still generate the minidumps but we
34 // do not upload them.
35 bool breakpad_enabled = true;
36 #else
37 bool breakpad_enabled = false;
38 #endif
40 // Allow Breakpad to be enabled in Chromium builds for testing purposes.
41 if (!breakpad_enabled)
42 breakpad_enabled = CommandLine::ForCurrentProcess()->HasSwitch(
43 switches::kEnableCrashReporterForTesting);
45 if (breakpad_enabled) {
46 base::FilePath crash_dump_dir;
47 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_dir);
48 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dump_dir));
51 ChromeBrowserMainParts::PreProfileInit();
54 void ChromeBrowserMainPartsAndroid::PreEarlyInitialization() {
55 TRACE_EVENT0("startup",
56 "ChromeBrowserMainPartsAndroid::PreEarlyInitialization")
57 net::NetworkChangeNotifier::SetFactory(
58 new net::NetworkChangeNotifierFactoryAndroid());
60 content::Compositor::Initialize();
62 // Chrome on Android does not use default MessageLoop. It has its own
63 // Android specific MessageLoop.
64 DCHECK(!main_message_loop_.get());
66 // Create and start the MessageLoop.
67 // This is a critical point in the startup process.
69 TRACE_EVENT0("startup",
70 "ChromeBrowserMainPartsAndroid::PreEarlyInitialization:CreateUiMsgLoop");
71 main_message_loop_.reset(new base::MessageLoopForUI);
75 TRACE_EVENT0("startup",
76 "ChromeBrowserMainPartsAndroid::PreEarlyInitialization:StartUiMsgLoop");
77 base::MessageLoopForUI::current()->Start();
80 ChromeBrowserMainParts::PreEarlyInitialization();
83 void ChromeBrowserMainPartsAndroid::ShowMissingLocaleMessageBox() {
84 NOTREACHED();