| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
| 11 #include "chrome/browser/browser.h" | 11 #include "chrome/browser/browser.h" |
| 12 #include "chrome/browser/browser_init.h" | 12 #include "chrome/browser/browser_init.h" |
| 13 #include "chrome/browser/browser_list.h" | 13 #include "chrome/browser/browser_list.h" |
| 14 #include "chrome/browser/browser_shutdown.h" | 14 #include "chrome/browser/browser_shutdown.h" |
| 15 #import "chrome/browser/cocoa/bookmark_menu_bridge.h" | 15 #import "chrome/browser/cocoa/bookmark_menu_bridge.h" |
| 16 #import "chrome/browser/cocoa/preferences_window_controller.h" |
| 16 #include "chrome/browser/command_updater.h" | 17 #include "chrome/browser/command_updater.h" |
| 17 #include "chrome/browser/profile_manager.h" | 18 #include "chrome/browser/profile_manager.h" |
| 18 #include "chrome/common/temp_scaffolding_stubs.h" | 19 #include "chrome/common/temp_scaffolding_stubs.h" |
| 19 | 20 |
| 20 @interface AppController(PRIVATE) | 21 @interface AppController(PRIVATE) |
| 21 - (void)initMenuState; | 22 - (void)initMenuState; |
| 22 - (void)getUrl:(NSAppleEventDescriptor*)event | 23 - (void)getUrl:(NSAppleEventDescriptor*)event |
| 23 withReply:(NSAppleEventDescriptor*)reply; | 24 withReply:(NSAppleEventDescriptor*)reply; |
| 24 - (void)openFiles:(NSAppleEventDescriptor*)event | 25 - (void)openFiles:(NSAppleEventDescriptor*)event |
| 25 withReply:(NSAppleEventDescriptor*)reply; | 26 withReply:(NSAppleEventDescriptor*)reply; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // openings through that for uniform handling. | 178 // openings through that for uniform handling. |
| 178 | 179 |
| 179 namespace { | 180 namespace { |
| 180 | 181 |
| 181 void OpenURLs(const std::vector<GURL>& urls) { | 182 void OpenURLs(const std::vector<GURL>& urls) { |
| 182 CommandLine dummy((std::wstring())); | 183 CommandLine dummy((std::wstring())); |
| 183 BrowserInit::LaunchWithProfile launch(std::wstring(), dummy); | 184 BrowserInit::LaunchWithProfile launch(std::wstring(), dummy); |
| 184 launch.OpenURLsInBrowser(BrowserList::GetLastActive(), false, urls); | 185 launch.OpenURLsInBrowser(BrowserList::GetLastActive(), false, urls); |
| 185 } | 186 } |
| 186 | 187 |
| 187 } | 188 } // namespace |
| 188 | 189 |
| 189 - (void)getUrl:(NSAppleEventDescriptor*)event | 190 - (void)getUrl:(NSAppleEventDescriptor*)event |
| 190 withReply:(NSAppleEventDescriptor*)reply { | 191 withReply:(NSAppleEventDescriptor*)reply { |
| 191 NSString* urlStr = [[event paramDescriptorForKeyword:keyDirectObject] | 192 NSString* urlStr = [[event paramDescriptorForKeyword:keyDirectObject] |
| 192 stringValue]; | 193 stringValue]; |
| 193 | 194 |
| 194 GURL gurl(base::SysNSStringToUTF8(urlStr)); | 195 GURL gurl(base::SysNSStringToUTF8(urlStr)); |
| 195 std::vector<GURL> gurlVector; | 196 std::vector<GURL> gurlVector; |
| 196 gurlVector.push_back(gurl); | 197 gurlVector.push_back(gurl); |
| 197 | 198 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 227 GURL gurl(std::string((char*)[fileURLData bytes], [fileURLData length])); | 228 GURL gurl(std::string((char*)[fileURLData bytes], [fileURLData length])); |
| 228 gurlVector.push_back(gurl); | 229 gurlVector.push_back(gurl); |
| 229 } | 230 } |
| 230 | 231 |
| 231 OpenURLs(gurlVector); | 232 OpenURLs(gurlVector); |
| 232 } | 233 } |
| 233 | 234 |
| 234 // Show the preferences window, or bring it to the front if it's already | 235 // Show the preferences window, or bring it to the front if it's already |
| 235 // visible. | 236 // visible. |
| 236 - (IBAction)showPreferences:(id)sender { | 237 - (IBAction)showPreferences:(id)sender { |
| 237 // TODO(pinkerton): more goes here... | 238 if (!prefsController_.get()) { |
| 239 PrefService* prefs = [self defaultProfile]->GetPrefs(); |
| 240 prefsController_.reset([[PreferencesWindowController alloc] |
| 241 initWithPrefs:prefs]); |
| 242 } |
| 243 [prefsController_ showPreferences:sender]; |
| 238 } | 244 } |
| 239 | 245 |
| 240 @end | 246 @end |
| OLD | NEW |