| 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 #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 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 if (!browser) | 124 if (!browser) |
| 125 browser = Browser::Create(bridge_->GetProfile()); | 125 browser = Browser::Create(bridge_->GetProfile()); |
| 126 DCHECK(browser); | 126 DCHECK(browser); |
| 127 | 127 |
| 128 if (!node || !browser) | 128 if (!node || !browser) |
| 129 return; // shouldn't be reached | 129 return; // shouldn't be reached |
| 130 | 130 |
| 131 bookmark_utils::OpenAll(NULL, browser->profile(), browser, node, | 131 bookmark_utils::OpenAll(NULL, browser->profile(), browser, node, |
| 132 disposition); | 132 disposition); |
| 133 | 133 |
| 134 const char* metrics_action = NULL; | |
| 135 if (disposition == NEW_FOREGROUND_TAB) { | 134 if (disposition == NEW_FOREGROUND_TAB) { |
| 136 metrics_action = "OpenAllBookmarks"; | 135 UserMetrics::RecordAction(UserMetricsAction("OpenAllBookmarks")); |
| 137 } else if (disposition == NEW_WINDOW) { | 136 } else if (disposition == NEW_WINDOW) { |
| 138 metrics_action = "OpenAllBookmarksNewWindow"; | 137 UserMetrics::RecordAction(UserMetricsAction("OpenAllBookmarksNewWindow")); |
| 139 } else { | 138 } else { |
| 140 metrics_action = "OpenAllBookmarksIncognitoWindow"; | 139 UserMetrics::RecordAction( |
| 140 UserMetricsAction("OpenAllBookmarksIncognitoWindow")); |
| 141 } | 141 } |
| 142 UserMetrics::RecordAction(UserMetricsAction(metrics_action)); | |
| 143 } | 142 } |
| 144 | 143 |
| 145 - (IBAction)openBookmarkMenuItem:(id)sender { | 144 - (IBAction)openBookmarkMenuItem:(id)sender { |
| 146 NSInteger tag = [sender tag]; | 145 NSInteger tag = [sender tag]; |
| 147 int identifier = tag; | 146 int identifier = tag; |
| 148 const BookmarkNode* node = [self nodeForIdentifier:identifier]; | 147 const BookmarkNode* node = [self nodeForIdentifier:identifier]; |
| 149 DCHECK(node); | 148 DCHECK(node); |
| 150 if (!node) | 149 if (!node) |
| 151 return; // shouldn't be reached | 150 return; // shouldn't be reached |
| 152 | 151 |
| 153 [self openURLForNode:node]; | 152 [self openURLForNode:node]; |
| 154 } | 153 } |
| 155 | 154 |
| 156 - (IBAction)openAllBookmarks:(id)sender { | 155 - (IBAction)openAllBookmarks:(id)sender { |
| 157 [self openAll:[sender tag] withDisposition:NEW_FOREGROUND_TAB]; | 156 [self openAll:[sender tag] withDisposition:NEW_FOREGROUND_TAB]; |
| 158 } | 157 } |
| 159 | 158 |
| 160 - (IBAction)openAllBookmarksNewWindow:(id)sender { | 159 - (IBAction)openAllBookmarksNewWindow:(id)sender { |
| 161 [self openAll:[sender tag] withDisposition:NEW_WINDOW]; | 160 [self openAll:[sender tag] withDisposition:NEW_WINDOW]; |
| 162 } | 161 } |
| 163 | 162 |
| 164 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender { | 163 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender { |
| 165 [self openAll:[sender tag] withDisposition:OFF_THE_RECORD]; | 164 [self openAll:[sender tag] withDisposition:OFF_THE_RECORD]; |
| 166 } | 165 } |
| 167 | 166 |
| 168 @end // BookmarkMenuCocoaController | 167 @end // BookmarkMenuCocoaController |
| OLD | NEW |