| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h" |
| 6 | 6 |
| 7 #import "base/mac/foundation_util.h" | 7 #import "base/mac/foundation_util.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" // IDC_BOOKMARK_MENU | 9 #include "chrome/app/chrome_command_ids.h" // IDC_BOOKMARK_MENU |
| 10 #import "chrome/browser/app_controller_mac.h" | 10 #import "chrome/browser/app_controller_mac.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if (!browser) { | 115 if (!browser) { |
| 116 browser = new Browser(Browser::CreateParams(bridge_->GetProfile())); | 116 browser = new Browser(Browser::CreateParams(bridge_->GetProfile())); |
| 117 } | 117 } |
| 118 DCHECK(browser); | 118 DCHECK(browser); |
| 119 | 119 |
| 120 if (!node || !browser) | 120 if (!node || !browser) |
| 121 return; // shouldn't be reached | 121 return; // shouldn't be reached |
| 122 | 122 |
| 123 chrome::OpenAll(NULL, browser, node, disposition, browser->profile()); | 123 chrome::OpenAll(NULL, browser, node, disposition, browser->profile()); |
| 124 | 124 |
| 125 if (disposition == NEW_FOREGROUND_TAB) { | 125 if (disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB) { |
| 126 content::RecordAction(UserMetricsAction("OpenAllBookmarks")); | 126 content::RecordAction(UserMetricsAction("OpenAllBookmarks")); |
| 127 } else if (disposition == NEW_WINDOW) { | 127 } else if (disposition == WindowOpenDisposition::NEW_WINDOW) { |
| 128 content::RecordAction(UserMetricsAction("OpenAllBookmarksNewWindow")); | 128 content::RecordAction(UserMetricsAction("OpenAllBookmarksNewWindow")); |
| 129 } else { | 129 } else { |
| 130 content::RecordAction( | 130 content::RecordAction( |
| 131 UserMetricsAction("OpenAllBookmarksIncognitoWindow")); | 131 UserMetricsAction("OpenAllBookmarksIncognitoWindow")); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 - (IBAction)openBookmarkMenuItem:(id)sender { | 135 - (IBAction)openBookmarkMenuItem:(id)sender { |
| 136 NSInteger tag = [sender tag]; | 136 NSInteger tag = [sender tag]; |
| 137 int identifier = tag; | 137 int identifier = tag; |
| 138 const BookmarkNode* node = [self nodeForIdentifier:identifier]; | 138 const BookmarkNode* node = [self nodeForIdentifier:identifier]; |
| 139 DCHECK(node); | 139 DCHECK(node); |
| 140 if (!node) | 140 if (!node) |
| 141 return; // shouldn't be reached | 141 return; // shouldn't be reached |
| 142 | 142 |
| 143 [self openURLForNode:node]; | 143 [self openURLForNode:node]; |
| 144 } | 144 } |
| 145 | 145 |
| 146 - (IBAction)openAllBookmarks:(id)sender { | 146 - (IBAction)openAllBookmarks:(id)sender { |
| 147 [self openAll:[sender tag] withDisposition:NEW_FOREGROUND_TAB]; | 147 WindowOpenDisposition disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
| 148 [self openAll:[sender tag] withDisposition:disposition]; |
| 148 } | 149 } |
| 149 | 150 |
| 150 - (IBAction)openAllBookmarksNewWindow:(id)sender { | 151 - (IBAction)openAllBookmarksNewWindow:(id)sender { |
| 151 [self openAll:[sender tag] withDisposition:NEW_WINDOW]; | 152 WindowOpenDisposition disposition = WindowOpenDisposition::NEW_WINDOW; |
| 153 [self openAll:[sender tag] withDisposition:disposition]; |
| 152 } | 154 } |
| 153 | 155 |
| 154 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender { | 156 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender { |
| 155 [self openAll:[sender tag] withDisposition:OFF_THE_RECORD]; | 157 WindowOpenDisposition disposition = WindowOpenDisposition::OFF_THE_RECORD; |
| 158 [self openAll:[sender tag] withDisposition:disposition]; |
| 156 } | 159 } |
| 157 | 160 |
| 158 @end // BookmarkMenuCocoaController | 161 @end // BookmarkMenuCocoaController |
| OLD | NEW |