| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 if (!browser) | 106 if (!browser) |
| 107 browser = Browser::Create(bridge_->GetProfile()); | 107 browser = Browser::Create(bridge_->GetProfile()); |
| 108 DCHECK(browser); | 108 DCHECK(browser); |
| 109 | 109 |
| 110 if (!node || !browser) | 110 if (!node || !browser) |
| 111 return; // shouldn't be reached | 111 return; // shouldn't be reached |
| 112 | 112 |
| 113 bookmark_utils::OpenAll(NULL, browser->profile(), browser, node, | 113 bookmark_utils::OpenAll(NULL, browser->profile(), browser, node, |
| 114 disposition); | 114 disposition); |
| 115 | 115 |
| 116 const char* metrics_action = NULL; | |
| 117 if (disposition == NEW_FOREGROUND_TAB) { | 116 if (disposition == NEW_FOREGROUND_TAB) { |
| 118 metrics_action = "OpenAllBookmarks"; | 117 UserMetrics::RecordAction(UserMetricsAction("OpenAllBookmarks")); |
| 119 } else if (disposition == NEW_WINDOW) { | 118 } else if (disposition == NEW_WINDOW) { |
| 120 metrics_action = "OpenAllBookmarksNewWindow"; | 119 UserMetrics::RecordAction(UserMetricsAction("OpenAllBookmarksNewWindow")); |
| 121 } else { | 120 } else { |
| 122 metrics_action = "OpenAllBookmarksIncognitoWindow"; | 121 UserMetrics::RecordAction( |
| 122 UserMetricsAction("OpenAllBookmarksIncognitoWindow")); |
| 123 } | 123 } |
| 124 UserMetrics::RecordAction(UserMetricsAction(metrics_action)); | |
| 125 } | 124 } |
| 126 | 125 |
| 127 - (IBAction)openBookmarkMenuItem:(id)sender { | 126 - (IBAction)openBookmarkMenuItem:(id)sender { |
| 128 NSInteger tag = [sender tag]; | 127 NSInteger tag = [sender tag]; |
| 129 int identifier = tag; | 128 int identifier = tag; |
| 130 const BookmarkNode* node = [self nodeForIdentifier:identifier]; | 129 const BookmarkNode* node = [self nodeForIdentifier:identifier]; |
| 131 DCHECK(node); | 130 DCHECK(node); |
| 132 if (!node) | 131 if (!node) |
| 133 return; // shouldn't be reached | 132 return; // shouldn't be reached |
| 134 | 133 |
| 135 [self openURLForNode:node]; | 134 [self openURLForNode:node]; |
| 136 } | 135 } |
| 137 | 136 |
| 138 - (IBAction)openAllBookmarks:(id)sender { | 137 - (IBAction)openAllBookmarks:(id)sender { |
| 139 [self openAll:[sender tag] withDisposition:NEW_FOREGROUND_TAB]; | 138 [self openAll:[sender tag] withDisposition:NEW_FOREGROUND_TAB]; |
| 140 } | 139 } |
| 141 | 140 |
| 142 - (IBAction)openAllBookmarksNewWindow:(id)sender { | 141 - (IBAction)openAllBookmarksNewWindow:(id)sender { |
| 143 [self openAll:[sender tag] withDisposition:NEW_WINDOW]; | 142 [self openAll:[sender tag] withDisposition:NEW_WINDOW]; |
| 144 } | 143 } |
| 145 | 144 |
| 146 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender { | 145 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender { |
| 147 [self openAll:[sender tag] withDisposition:OFF_THE_RECORD]; | 146 [self openAll:[sender tag] withDisposition:OFF_THE_RECORD]; |
| 148 } | 147 } |
| 149 | 148 |
| 150 @end // BookmarkMenuCocoaController | 149 @end // BookmarkMenuCocoaController |
| 151 | 150 |
| OLD | NEW |