| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| 11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_utils.h" | 12 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 13 #include "chrome/browser/download/download_shelf.h" | 13 #include "chrome/browser/download/download_shelf.h" |
| 14 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 14 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| 15 #include "chrome/browser/page_info_window.h" | 15 #include "chrome/browser/page_info_window.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/sidebar/sidebar_container.h" | 18 #include "chrome/browser/sidebar/sidebar_container.h" |
| 19 #include "chrome/browser/sidebar/sidebar_manager.h" | 19 #include "chrome/browser/sidebar/sidebar_manager.h" |
| 20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_list.h" | 21 #include "chrome/browser/ui/browser_list.h" |
| 22 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 22 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 23 #import "chrome/browser/ui/cocoa/bug_report_window_controller.h" | 23 #import "chrome/browser/ui/cocoa/bug_report_window_controller.h" |
| 24 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 24 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
| 25 #import "chrome/browser/ui/cocoa/clear_browsing_data_controller.h" | |
| 26 #import "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h" | 25 #import "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h" |
| 27 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" | 26 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" |
| 28 #import "chrome/browser/ui/cocoa/html_dialog_window_controller.h" | 27 #import "chrome/browser/ui/cocoa/html_dialog_window_controller.h" |
| 29 #import "chrome/browser/ui/cocoa/importer/import_dialog_cocoa.h" | 28 #import "chrome/browser/ui/cocoa/importer/import_dialog_cocoa.h" |
| 30 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 29 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 31 #import "chrome/browser/ui/cocoa/nsmenuitem_additions.h" | 30 #import "chrome/browser/ui/cocoa/nsmenuitem_additions.h" |
| 32 #import "chrome/browser/ui/cocoa/options/content_settings_dialog_controller.h" | |
| 33 #import "chrome/browser/ui/cocoa/options/edit_search_engine_cocoa_controller.h" | |
| 34 #import "chrome/browser/ui/cocoa/options/keyword_editor_cocoa_controller.h" | |
| 35 #include "chrome/browser/ui/cocoa/repost_form_warning_mac.h" | 31 #include "chrome/browser/ui/cocoa/repost_form_warning_mac.h" |
| 36 #include "chrome/browser/ui/cocoa/restart_browser.h" | 32 #include "chrome/browser/ui/cocoa/restart_browser.h" |
| 37 #include "chrome/browser/ui/cocoa/status_bubble_mac.h" | 33 #include "chrome/browser/ui/cocoa/status_bubble_mac.h" |
| 38 #include "chrome/browser/ui/cocoa/task_manager_mac.h" | 34 #include "chrome/browser/ui/cocoa/task_manager_mac.h" |
| 39 #import "chrome/browser/ui/cocoa/theme_install_bubble_view.h" | 35 #import "chrome/browser/ui/cocoa/theme_install_bubble_view.h" |
| 40 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 36 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 41 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 42 #include "chrome/common/native_web_keyboard_event.h" | 38 #include "chrome/common/native_web_keyboard_event.h" |
| 43 #include "chrome/common/notification_service.h" | 39 #include "chrome/common/notification_service.h" |
| 44 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 return !![controller_ isFullscreen]; | 213 return !![controller_ isFullscreen]; |
| 218 } | 214 } |
| 219 | 215 |
| 220 bool BrowserWindowCocoa::IsFullscreenBubbleVisible() const { | 216 bool BrowserWindowCocoa::IsFullscreenBubbleVisible() const { |
| 221 return false; | 217 return false; |
| 222 } | 218 } |
| 223 | 219 |
| 224 void BrowserWindowCocoa::ConfirmAddSearchProvider( | 220 void BrowserWindowCocoa::ConfirmAddSearchProvider( |
| 225 const TemplateURL* template_url, | 221 const TemplateURL* template_url, |
| 226 Profile* profile) { | 222 Profile* profile) { |
| 227 // The controller will release itself when the window closes. | 223 NOTIMPLEMENTED(); |
| 228 EditSearchEngineCocoaController* editor = | |
| 229 [[EditSearchEngineCocoaController alloc] initWithProfile:profile | |
| 230 delegate:NULL | |
| 231 templateURL:template_url]; | |
| 232 [NSApp beginSheet:[editor window] | |
| 233 modalForWindow:window() | |
| 234 modalDelegate:controller_ | |
| 235 didEndSelector:@selector(sheetDidEnd:returnCode:context:) | |
| 236 contextInfo:NULL]; | |
| 237 } | 224 } |
| 238 | 225 |
| 239 LocationBar* BrowserWindowCocoa::GetLocationBar() const { | 226 LocationBar* BrowserWindowCocoa::GetLocationBar() const { |
| 240 return [controller_ locationBarBridge]; | 227 return [controller_ locationBarBridge]; |
| 241 } | 228 } |
| 242 | 229 |
| 243 void BrowserWindowCocoa::SetFocusToLocationBar(bool select_all) { | 230 void BrowserWindowCocoa::SetFocusToLocationBar(bool select_all) { |
| 244 [controller_ focusLocationBar:select_all ? YES : NO]; | 231 [controller_ focusLocationBar:select_all ? YES : NO]; |
| 245 } | 232 } |
| 246 | 233 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 bool BrowserWindowCocoa::IsDownloadShelfVisible() const { | 317 bool BrowserWindowCocoa::IsDownloadShelfVisible() const { |
| 331 return [controller_ isDownloadShelfVisible] != NO; | 318 return [controller_ isDownloadShelfVisible] != NO; |
| 332 } | 319 } |
| 333 | 320 |
| 334 DownloadShelf* BrowserWindowCocoa::GetDownloadShelf() { | 321 DownloadShelf* BrowserWindowCocoa::GetDownloadShelf() { |
| 335 DownloadShelfController* shelfController = [controller_ downloadShelf]; | 322 DownloadShelfController* shelfController = [controller_ downloadShelf]; |
| 336 return [shelfController bridge]; | 323 return [shelfController bridge]; |
| 337 } | 324 } |
| 338 | 325 |
| 339 void BrowserWindowCocoa::ShowClearBrowsingDataDialog() { | 326 void BrowserWindowCocoa::ShowClearBrowsingDataDialog() { |
| 340 [ClearBrowsingDataController | 327 NOTIMPLEMENTED(); |
| 341 showClearBrowsingDialogForProfile:browser_->profile()]; | |
| 342 } | 328 } |
| 343 | 329 |
| 344 void BrowserWindowCocoa::ShowImportDialog() { | 330 void BrowserWindowCocoa::ShowImportDialog() { |
| 345 [ImportDialogController | 331 NOTIMPLEMENTED(); |
| 346 showImportSettingsDialogForProfile:browser_->profile()]; | |
| 347 } | 332 } |
| 348 | 333 |
| 349 void BrowserWindowCocoa::ShowSearchEnginesDialog() { | 334 void BrowserWindowCocoa::ShowSearchEnginesDialog() { |
| 350 [KeywordEditorCocoaController showKeywordEditor:browser_->profile()]; | 335 NOTIMPLEMENTED(); |
| 351 } | 336 } |
| 352 | 337 |
| 353 void BrowserWindowCocoa::ShowPasswordManager() { | 338 void BrowserWindowCocoa::ShowPasswordManager() { |
| 354 NOTIMPLEMENTED(); | 339 NOTIMPLEMENTED(); |
| 355 } | 340 } |
| 356 | 341 |
| 357 void BrowserWindowCocoa::ShowRepostFormWarningDialog( | 342 void BrowserWindowCocoa::ShowRepostFormWarningDialog( |
| 358 TabContents* tab_contents) { | 343 TabContents* tab_contents) { |
| 359 RepostFormWarningMac::Create(GetNativeHandle(), tab_contents); | 344 RepostFormWarningMac::Create(GetNativeHandle(), tab_contents); |
| 360 } | 345 } |
| 361 | 346 |
| 362 void BrowserWindowCocoa::ShowContentSettingsWindow( | 347 void BrowserWindowCocoa::ShowContentSettingsWindow( |
| 363 ContentSettingsType settings_type, | 348 ContentSettingsType settings_type, |
| 364 Profile* profile) { | 349 Profile* profile) { |
| 365 [ContentSettingsDialogController showContentSettingsForType:settings_type | 350 NOTIMPLEMENTED(); |
| 366 profile:profile]; | |
| 367 } | 351 } |
| 368 | 352 |
| 369 void BrowserWindowCocoa::ShowCollectedCookiesDialog(TabContents* tab_contents) { | 353 void BrowserWindowCocoa::ShowCollectedCookiesDialog(TabContents* tab_contents) { |
| 370 // Deletes itself on close. | 354 // Deletes itself on close. |
| 371 new CollectedCookiesMac(GetNativeHandle(), tab_contents); | 355 new CollectedCookiesMac(GetNativeHandle(), tab_contents); |
| 372 } | 356 } |
| 373 | 357 |
| 374 void BrowserWindowCocoa::ShowProfileErrorDialog(int message_id) { | 358 void BrowserWindowCocoa::ShowProfileErrorDialog(int message_id) { |
| 375 scoped_nsobject<NSAlert> alert([[NSAlert alloc] init]); | 359 scoped_nsobject<NSAlert> alert([[NSAlert alloc] init]); |
| 376 [alert addButtonWithTitle:l10n_util::GetNSStringWithFixup(IDS_OK)]; | 360 [alert addButtonWithTitle:l10n_util::GetNSStringWithFixup(IDS_OK)]; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 | 620 |
| 637 NSWindow* BrowserWindowCocoa::window() const { | 621 NSWindow* BrowserWindowCocoa::window() const { |
| 638 return [controller_ window]; | 622 return [controller_ window]; |
| 639 } | 623 } |
| 640 | 624 |
| 641 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { | 625 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { |
| 642 if (tab_contents == browser_->GetSelectedTabContents()) { | 626 if (tab_contents == browser_->GetSelectedTabContents()) { |
| 643 [controller_ updateSidebarForContents:tab_contents]; | 627 [controller_ updateSidebarForContents:tab_contents]; |
| 644 } | 628 } |
| 645 } | 629 } |
| OLD | NEW |