OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/bookmark_bubble_controller.h" | 5 #import "chrome/browser/cocoa/bookmark_bubble_controller.h" |
6 | 6 |
7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "base/utf_string_conversions.h" // TODO(viettrungluu): remove | 10 #include "base/utf_string_conversions.h" // TODO(viettrungluu): remove |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 320 |
321 // Look at the dialog; if the user has changed anything, update the | 321 // Look at the dialog; if the user has changed anything, update the |
322 // bookmark node to reflect this. | 322 // bookmark node to reflect this. |
323 - (void)updateBookmarkNode { | 323 - (void)updateBookmarkNode { |
324 if (!node_) return; | 324 if (!node_) return; |
325 | 325 |
326 // First the title... | 326 // First the title... |
327 NSString* oldTitle = base::SysWideToNSString(node_->GetTitle()); | 327 NSString* oldTitle = base::SysWideToNSString(node_->GetTitle()); |
328 NSString* newTitle = [nameTextField_ stringValue]; | 328 NSString* newTitle = [nameTextField_ stringValue]; |
329 if (![oldTitle isEqual:newTitle]) { | 329 if (![oldTitle isEqual:newTitle]) { |
330 model_->SetTitle(node_, base::SysNSStringToWide(newTitle)); | 330 model_->SetTitle(node_, base::SysNSStringToUTF16(newTitle)); |
331 UserMetrics::RecordAction( | 331 UserMetrics::RecordAction( |
332 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble"), | 332 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble"), |
333 model_->profile()); | 333 model_->profile()); |
334 } | 334 } |
335 // Then the parent folder. | 335 // Then the parent folder. |
336 const BookmarkNode* oldParent = node_->GetParent(); | 336 const BookmarkNode* oldParent = node_->GetParent(); |
337 NSMenuItem* selectedItem = [folderPopUpButton_ selectedItem]; | 337 NSMenuItem* selectedItem = [folderPopUpButton_ selectedItem]; |
338 id representedObject = [selectedItem representedObject]; | 338 id representedObject = [selectedItem representedObject]; |
339 if ([representedObject isEqual:[[self class] chooseAnotherFolderObject]]) { | 339 if ([representedObject isEqual:[[self class] chooseAnotherFolderObject]]) { |
340 // "Choose another folder..." | 340 // "Choose another folder..." |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; | 420 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; |
421 DCHECK(idx != -1); | 421 DCHECK(idx != -1); |
422 [folderPopUpButton_ selectItemAtIndex:idx]; | 422 [folderPopUpButton_ selectItemAtIndex:idx]; |
423 } | 423 } |
424 | 424 |
425 - (NSPopUpButton*)folderPopUpButton { | 425 - (NSPopUpButton*)folderPopUpButton { |
426 return folderPopUpButton_; | 426 return folderPopUpButton_; |
427 } | 427 } |
428 | 428 |
429 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) | 429 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) |
OLD | NEW |