| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 ViewsContentClientMainPartsMac::ViewsContentClientMainPartsMac( | 49 ViewsContentClientMainPartsMac::ViewsContentClientMainPartsMac( |
| 50 const content::MainFunctionParams& content_params, | 50 const content::MainFunctionParams& content_params, |
| 51 ViewsContentClient* views_content_client) | 51 ViewsContentClient* views_content_client) |
| 52 : ViewsContentClientMainParts(content_params, views_content_client) { | 52 : ViewsContentClientMainParts(content_params, views_content_client) { |
| 53 // Cache the child process path to avoid triggering an AssertIOAllowed. | 53 // Cache the child process path to avoid triggering an AssertIOAllowed. |
| 54 base::FilePath child_process_exe; | 54 base::FilePath child_process_exe; |
| 55 PathService::Get(content::CHILD_PROCESS_EXE, &child_process_exe); | 55 PathService::Get(content::CHILD_PROCESS_EXE, &child_process_exe); |
| 56 | 56 |
| 57 // Disable plugin discovery since NPAPI plugin support on Mac requires this to | |
| 58 // be done in a utility process type which isn't bundled with this executable. | |
| 59 content::PluginService::GetInstance()->DisablePluginsDiscoveryForTesting(); | |
| 60 | |
| 61 app_controller_.reset([[ViewsContentClientAppController alloc] init]); | 57 app_controller_.reset([[ViewsContentClientAppController alloc] init]); |
| 62 [[NSApplication sharedApplication] setDelegate:app_controller_]; | 58 [[NSApplication sharedApplication] setDelegate:app_controller_]; |
| 63 } | 59 } |
| 64 | 60 |
| 65 void ViewsContentClientMainPartsMac::PreMainMessageLoopRun() { | 61 void ViewsContentClientMainPartsMac::PreMainMessageLoopRun() { |
| 66 ViewsContentClientMainParts::PreMainMessageLoopRun(); | 62 ViewsContentClientMainParts::PreMainMessageLoopRun(); |
| 67 | 63 |
| 68 // On Mac, the task must be deferred to applicationDidFinishLaunching. If not, | 64 // On Mac, the task must be deferred to applicationDidFinishLaunching. If not, |
| 69 // the widget can activate, but (even if configured) the mainMenu won't be | 65 // the widget can activate, but (even if configured) the mainMenu won't be |
| 70 // ready to switch over in the OSX UI, so it will look strange. | 66 // ready to switch over in the OSX UI, so it will look strange. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 NSString* quitTitle = [@"Quit " stringByAppendingString:appName]; | 111 NSString* quitTitle = [@"Quit " stringByAppendingString:appName]; |
| 116 [appMenu addItemWithTitle:quitTitle | 112 [appMenu addItemWithTitle:quitTitle |
| 117 action:@selector(terminate:) | 113 action:@selector(terminate:) |
| 118 keyEquivalent:@"q"]; | 114 keyEquivalent:@"q"]; |
| 119 [appMenuItem setSubmenu:appMenu]; | 115 [appMenuItem setSubmenu:appMenu]; |
| 120 | 116 |
| 121 task_.Run(); | 117 task_.Run(); |
| 122 } | 118 } |
| 123 | 119 |
| 124 @end | 120 @end |
| OLD | NEW |