Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1617)

Side by Side Diff: chrome/browser/chrome_browser_main_mac.mm

Issue 666533007: Move JavaScriptDialogManager, JavascriptAppModalDialogViews to components/app_modal_dialogs (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_mac.h" 5 #include "chrome/browser/chrome_browser_main_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <sys/sysctl.h> 8 #include <sys/sysctl.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/mac/bundle_locations.h" 12 #include "base/mac/bundle_locations.h"
13 #include "base/mac/mac_util.h" 13 #include "base/mac/mac_util.h"
14 #include "base/mac/scoped_nsobject.h" 14 #include "base/mac/scoped_nsobject.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #import "chrome/browser/app_controller_mac.h" 17 #import "chrome/browser/app_controller_mac.h"
18 #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h" 18 #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #import "chrome/browser/chrome_browser_application_mac.h" 20 #import "chrome/browser/chrome_browser_application_mac.h"
21 #include "chrome/browser/mac/install_from_dmg.h" 21 #include "chrome/browser/mac/install_from_dmg.h"
22 #import "chrome/browser/mac/keystone_glue.h" 22 #import "chrome/browser/mac/keystone_glue.h"
23 #include "chrome/browser/mac/mac_startup_profiler.h" 23 #include "chrome/browser/mac/mac_startup_profiler.h"
24 #include "chrome/browser/ui/app_list/app_list_service.h" 24 #include "chrome/browser/ui/app_list/app_list_service.h"
25 #include "chrome/browser/ui/app_modal_dialogs/chrome_javascript_dialog_manager_c lient.h"
25 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
26 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
27 #include "components/crash/app/breakpad_mac.h" 28 #include "components/crash/app/breakpad_mac.h"
28 #include "components/metrics/metrics_service.h" 29 #include "components/metrics/metrics_service.h"
29 #include "content/public/common/main_function_params.h" 30 #include "content/public/common/main_function_params.h"
30 #include "content/public/common/result_codes.h" 31 #include "content/public/common/result_codes.h"
31 #include "ui/base/l10n/l10n_util_mac.h" 32 #include "ui/base/l10n/l10n_util_mac.h"
32 #include "ui/base/resource/resource_bundle.h" 33 #include "ui/base/resource/resource_bundle.h"
33 #include "ui/base/resource/resource_handle.h" 34 #include "ui/base/resource/resource_handle.h"
34 35
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } // namespace 153 } // namespace
153 154
154 // ChromeBrowserMainPartsMac --------------------------------------------------- 155 // ChromeBrowserMainPartsMac ---------------------------------------------------
155 156
156 ChromeBrowserMainPartsMac::ChromeBrowserMainPartsMac( 157 ChromeBrowserMainPartsMac::ChromeBrowserMainPartsMac(
157 const content::MainFunctionParams& parameters) 158 const content::MainFunctionParams& parameters)
158 : ChromeBrowserMainPartsPosix(parameters) { 159 : ChromeBrowserMainPartsPosix(parameters) {
159 } 160 }
160 161
161 ChromeBrowserMainPartsMac::~ChromeBrowserMainPartsMac() { 162 ChromeBrowserMainPartsMac::~ChromeBrowserMainPartsMac() {
163 SetJavaScriptDialogManagerClient(nullptr);
162 } 164 }
163 165
164 void ChromeBrowserMainPartsMac::PreEarlyInitialization() { 166 void ChromeBrowserMainPartsMac::PreEarlyInitialization() {
165 ChromeBrowserMainPartsPosix::PreEarlyInitialization(); 167 ChromeBrowserMainPartsPosix::PreEarlyInitialization();
166 168
167 if (base::mac::WasLaunchedAsLoginItemRestoreState()) { 169 if (base::mac::WasLaunchedAsLoginItemRestoreState()) {
168 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); 170 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess();
169 singleton_command_line->AppendSwitch(switches::kRestoreLastSession); 171 singleton_command_line->AppendSwitch(switches::kRestoreLastSession);
170 } else if (base::mac::WasLaunchedAsHiddenLoginItem()) { 172 } else if (base::mac::WasLaunchedAsHiddenLoginItem()) {
171 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); 173 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 }]; 263 }];
262 } 264 }
263 265
264 void ChromeBrowserMainPartsMac::PostMainMessageLoopStart() { 266 void ChromeBrowserMainPartsMac::PostMainMessageLoopStart() {
265 MacStartupProfiler::GetInstance()->Profile( 267 MacStartupProfiler::GetInstance()->Profile(
266 MacStartupProfiler::POST_MAIN_MESSAGE_LOOP_START); 268 MacStartupProfiler::POST_MAIN_MESSAGE_LOOP_START);
267 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart(); 269 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart();
268 } 270 }
269 271
270 void ChromeBrowserMainPartsMac::PreProfileInit() { 272 void ChromeBrowserMainPartsMac::PreProfileInit() {
273 SetJavaScriptDialogManagerClient(
274 make_scoped_ptr(new ChromeJavaScriptDialogManagerClient));
275
271 MacStartupProfiler::GetInstance()->Profile( 276 MacStartupProfiler::GetInstance()->Profile(
272 MacStartupProfiler::PRE_PROFILE_INIT); 277 MacStartupProfiler::PRE_PROFILE_INIT);
273 ChromeBrowserMainPartsPosix::PreProfileInit(); 278 ChromeBrowserMainPartsPosix::PreProfileInit();
274 // This is called here so that the app shim socket is only created after 279 // This is called here so that the app shim socket is only created after
275 // taking the singleton lock. 280 // taking the singleton lock.
276 g_browser_process->platform_part()->app_shim_host_manager()->Init(); 281 g_browser_process->platform_part()->app_shim_host_manager()->Init();
277 AppListService::InitAll(NULL); 282 AppListService::InitAll(NULL);
278 } 283 }
279 284
280 void ChromeBrowserMainPartsMac::PostProfileInit() { 285 void ChromeBrowserMainPartsMac::PostProfileInit() {
281 MacStartupProfiler::GetInstance()->Profile( 286 MacStartupProfiler::GetInstance()->Profile(
282 MacStartupProfiler::POST_PROFILE_INIT); 287 MacStartupProfiler::POST_PROFILE_INIT);
283 ChromeBrowserMainPartsPosix::PostProfileInit(); 288 ChromeBrowserMainPartsPosix::PostProfileInit();
284 g_browser_process->metrics_service()->RecordBreakpadRegistration( 289 g_browser_process->metrics_service()->RecordBreakpadRegistration(
285 breakpad::IsCrashReporterEnabled()); 290 breakpad::IsCrashReporterEnabled());
286 } 291 }
287 292
288 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { 293 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() {
289 AppController* appController = [NSApp delegate]; 294 AppController* appController = [NSApp delegate];
290 [appController didEndMainMessageLoop]; 295 [appController didEndMainMessageLoop];
291 } 296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698