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

Side by Side Diff: chrome/browser/cocoa/browser_window_controller.mm

Issue 330002: Mac: implement dispositions for back/forward buttons (not in drop-downs). (Closed)
Patch Set: We never need to call Revert() on back/forwards, so the logic can be simplified. Created 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bookmarks/bookmark_editor.h" 12 #include "chrome/browser/bookmarks/bookmark_editor.h"
13 #include "chrome/browser/browser.h" 13 #include "chrome/browser/browser.h"
14 #include "chrome/browser/browser_list.h" 14 #include "chrome/browser/browser_list.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/encoding_menu_controller.h" 16 #include "chrome/browser/encoding_menu_controller.h"
17 #include "chrome/browser/location_bar.h" 17 #include "chrome/browser/location_bar.h"
18 #include "chrome/browser/profile.h" 18 #include "chrome/browser/profile.h"
19 #include "chrome/browser/renderer_host/render_widget_host_view.h" 19 #include "chrome/browser/renderer_host/render_widget_host_view.h"
20 #include "chrome/browser/tab_contents/tab_contents.h" 20 #include "chrome/browser/tab_contents/tab_contents.h"
21 #include "chrome/browser/tab_contents/tab_contents_view.h" 21 #include "chrome/browser/tab_contents/tab_contents_view.h"
22 #include "chrome/browser/tabs/tab_strip_model.h" 22 #include "chrome/browser/tabs/tab_strip_model.h"
23 #import "chrome/browser/cocoa/bookmark_bar_controller.h" 23 #import "chrome/browser/cocoa/bookmark_bar_controller.h"
24 #import "chrome/browser/cocoa/bookmark_editor_controller.h" 24 #import "chrome/browser/cocoa/bookmark_editor_controller.h"
25 #import "chrome/browser/cocoa/browser_window_cocoa.h" 25 #import "chrome/browser/cocoa/browser_window_cocoa.h"
26 #import "chrome/browser/cocoa/browser_window_controller.h" 26 #import "chrome/browser/cocoa/browser_window_controller.h"
27 #import "chrome/browser/cocoa/chrome_browser_window.h" 27 #import "chrome/browser/cocoa/chrome_browser_window.h"
28 #import "chrome/browser/cocoa/download_shelf_controller.h" 28 #import "chrome/browser/cocoa/download_shelf_controller.h"
29 #import "chrome/browser/cocoa/event_utils.h"
29 #import "chrome/browser/cocoa/extension_shelf_controller.h" 30 #import "chrome/browser/cocoa/extension_shelf_controller.h"
30 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h" 31 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h"
31 #include "chrome/browser/cocoa/find_bar_bridge.h" 32 #include "chrome/browser/cocoa/find_bar_bridge.h"
32 #import "chrome/browser/cocoa/fullscreen_window.h" 33 #import "chrome/browser/cocoa/fullscreen_window.h"
33 #import "chrome/browser/cocoa/infobar_container_controller.h" 34 #import "chrome/browser/cocoa/infobar_container_controller.h"
34 #import "chrome/browser/cocoa/status_bubble_mac.h" 35 #import "chrome/browser/cocoa/status_bubble_mac.h"
35 #import "chrome/browser/cocoa/tab_strip_model_observer_bridge.h" 36 #import "chrome/browser/cocoa/tab_strip_model_observer_bridge.h"
36 #import "chrome/browser/cocoa/tab_strip_view.h" 37 #import "chrome/browser/cocoa/tab_strip_view.h"
37 #import "chrome/browser/cocoa/tab_strip_controller.h" 38 #import "chrome/browser/cocoa/tab_strip_controller.h"
38 #import "chrome/browser/cocoa/tab_view.h" 39 #import "chrome/browser/cocoa/tab_view.h"
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 593
593 // Called when the user picks a menu or toolbar item when this window is key. 594 // Called when the user picks a menu or toolbar item when this window is key.
594 // Calls through to the browser object to execute the command. This assumes that 595 // Calls through to the browser object to execute the command. This assumes that
595 // the command is supported and doesn't check, otherwise it would have been 596 // the command is supported and doesn't check, otherwise it would have been
596 // disabled in the UI in validateUserInterfaceItem:. 597 // disabled in the UI in validateUserInterfaceItem:.
597 - (void)commandDispatch:(id)sender { 598 - (void)commandDispatch:(id)sender {
598 NSInteger tag = [sender tag]; 599 NSInteger tag = [sender tag];
599 switch (tag) { 600 switch (tag) {
600 case IDC_FORWARD: 601 case IDC_FORWARD:
601 case IDC_BACK: 602 case IDC_BACK:
602 [self locationBar]->Revert(); 603 // For this, we need to check the key flags to figure out where to open
603 break; 604 // the history item. Note that |Revert()| isn't needed, since any
605 // navigation in the current tab will reset the location bar's contents.
606 browser_->ExecuteCommandWithDisposition(tag,
607 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]));
608 return;
604 case IDC_RELOAD: 609 case IDC_RELOAD:
605 if ([sender isKindOfClass:[NSButton class]]) { 610 if ([sender isKindOfClass:[NSButton class]]) {
606 // We revert the bar when the reload button is pressed, but don't when 611 // We revert the bar when the reload button is pressed, but don't when
607 // Command+r is pressed (Issue 15464). Unlike the event handler function 612 // Command+r is pressed (Issue 15464). Unlike the event handler function
608 // for Windows (ToolbarView::ButtonPressed()), this function handles 613 // for Windows (ToolbarView::ButtonPressed()), this function handles
609 // both reload button press event and Command+r press event. Thus the 614 // both reload button press event and Command+r press event. Thus the
610 // 'isKindofClass' check is necessary. 615 // 'isKindofClass' check is necessary.
611 [self locationBar]->Revert(); 616 [self locationBar]->Revert();
612 } 617 }
613 break; 618 break;
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1531 if (frameOverlayInactiveImage) { 1536 if (frameOverlayInactiveImage) {
1532 [theme setValue:frameOverlayInactiveImage 1537 [theme setValue:frameOverlayInactiveImage
1533 forAttribute:@"overlay" 1538 forAttribute:@"overlay"
1534 style:GTMThemeStyleWindow 1539 style:GTMThemeStyleWindow
1535 state:GTMThemeStateInactiveWindow]; 1540 state:GTMThemeStateInactiveWindow];
1536 } 1541 }
1537 1542
1538 return theme; 1543 return theme;
1539 } 1544 }
1540 @end 1545 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698