| 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 #include <Carbon/Carbon.h> | 5 #include <Carbon/Carbon.h> |
| 6 | 6 |
| 7 #include "base/mac_util.h" | 7 #include "base/mac_util.h" |
| 8 #include "base/scoped_nsdisable_screen_updates.h" | 8 #include "base/scoped_nsdisable_screen_updates.h" |
| 9 #import "base/scoped_nsobject.h" | 9 #import "base/scoped_nsobject.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| 11 #include "chrome/app/chrome_dll_resource.h" // IDC_* | 11 #include "chrome/app/chrome_dll_resource.h" // IDC_* |
| 12 #include "chrome/browser/browser.h" | 12 #include "chrome/browser/browser.h" |
| 13 #include "chrome/browser/browser_list.h" | 13 #include "chrome/browser/browser_list.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/encoding_menu_controller.h" | 15 #include "chrome/browser/encoding_menu_controller.h" |
| 16 #include "chrome/browser/location_bar.h" |
| 16 #include "chrome/browser/profile.h" | 17 #include "chrome/browser/profile.h" |
| 17 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 18 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 18 #include "chrome/browser/tab_contents/tab_contents.h" | 19 #include "chrome/browser/tab_contents/tab_contents.h" |
| 19 #include "chrome/browser/tab_contents/tab_contents_view.h" | 20 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 20 #include "chrome/browser/tabs/tab_strip_model.h" | 21 #include "chrome/browser/tabs/tab_strip_model.h" |
| 21 #import "chrome/browser/cocoa/bookmark_bar_controller.h" | 22 #import "chrome/browser/cocoa/bookmark_bar_controller.h" |
| 22 #import "chrome/browser/cocoa/browser_window_cocoa.h" | 23 #import "chrome/browser/cocoa/browser_window_cocoa.h" |
| 23 #import "chrome/browser/cocoa/browser_window_controller.h" | 24 #import "chrome/browser/cocoa/browser_window_controller.h" |
| 24 #import "chrome/browser/cocoa/download_shelf_controller.h" | 25 #import "chrome/browser/cocoa/download_shelf_controller.h" |
| 25 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h" | 26 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } | 454 } |
| 454 return enable; | 455 return enable; |
| 455 } | 456 } |
| 456 | 457 |
| 457 // Called when the user picks a menu or toolbar item when this window is key. | 458 // Called when the user picks a menu or toolbar item when this window is key. |
| 458 // Calls through to the browser object to execute the command. This assumes that | 459 // Calls through to the browser object to execute the command. This assumes that |
| 459 // the command is supported and doesn't check, otherwise it would have been | 460 // the command is supported and doesn't check, otherwise it would have been |
| 460 // disabled in the UI in validateUserInterfaceItem:. | 461 // disabled in the UI in validateUserInterfaceItem:. |
| 461 - (void)commandDispatch:(id)sender { | 462 - (void)commandDispatch:(id)sender { |
| 462 NSInteger tag = [sender tag]; | 463 NSInteger tag = [sender tag]; |
| 464 switch (tag) { |
| 465 case IDC_FORWARD: |
| 466 case IDC_BACK: |
| 467 [self locationBar]->Revert(); |
| 468 break; |
| 469 case IDC_RELOAD: |
| 470 if ([sender isKindOfClass:[NSButton class]]) { |
| 471 // We revert the bar when the reload button is pressed, but don't when |
| 472 // Command+r is pressed (Issue 15464). Unlike the event handler function |
| 473 // for Windows (ToolbarView::ButtonPressed()), this function handles |
| 474 // both reload button press event and Command+r press event. Thus the |
| 475 // 'isKindofClass' check is necessary. |
| 476 [self locationBar]->Revert(); |
| 477 } |
| 478 break; |
| 479 } |
| 463 browser_->ExecuteCommand(tag); | 480 browser_->ExecuteCommand(tag); |
| 464 } | 481 } |
| 465 | 482 |
| 466 // Called when another part of the internal codebase needs to execute a | 483 // Called when another part of the internal codebase needs to execute a |
| 467 // command. | 484 // command. |
| 468 - (void)executeCommand:(int)command { | 485 - (void)executeCommand:(int)command { |
| 469 if (browser_->command_updater()->IsCommandEnabled(command)) | 486 if (browser_->command_updater()->IsCommandEnabled(command)) |
| 470 browser_->ExecuteCommand(command); | 487 browser_->ExecuteCommand(command); |
| 471 } | 488 } |
| 472 | 489 |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 NSColor* toolbarButtonBorderColor = toolbarButtonIconColor; | 1186 NSColor* toolbarButtonBorderColor = toolbarButtonIconColor; |
| 1170 [theme setValue:toolbarButtonBorderColor | 1187 [theme setValue:toolbarButtonBorderColor |
| 1171 forAttribute:@"borderColor" | 1188 forAttribute:@"borderColor" |
| 1172 style:GTMThemeStyleToolBar | 1189 style:GTMThemeStyleToolBar |
| 1173 state:YES]; | 1190 state:YES]; |
| 1174 | 1191 |
| 1175 return theme; | 1192 return theme; |
| 1176 } | 1193 } |
| 1177 @end | 1194 @end |
| 1178 | 1195 |
| OLD | NEW |