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

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc

Issue 112913004: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 months 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 | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 &promo_background_color); 408 &promo_background_color);
409 } 409 }
410 410
411 void BookmarkBubbleGtk::ApplyEdits() { 411 void BookmarkBubbleGtk::ApplyEdits() {
412 // Set this to make sure we don't attempt to apply edits again. 412 // Set this to make sure we don't attempt to apply edits again.
413 apply_edits_ = false; 413 apply_edits_ = false;
414 414
415 const BookmarkNode* node = model_->GetMostRecentlyAddedNodeForURL(url_); 415 const BookmarkNode* node = model_->GetMostRecentlyAddedNodeForURL(url_);
416 if (node) { 416 if (node) {
417 const base::string16 new_title( 417 const base::string16 new_title(
418 UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(name_entry_)))); 418 base::UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(name_entry_))));
419 419
420 if (new_title != node->GetTitle()) { 420 if (new_title != node->GetTitle()) {
421 model_->SetTitle(node, new_title); 421 model_->SetTitle(node, new_title);
422 content::RecordAction( 422 content::RecordAction(
423 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); 423 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble"));
424 } 424 }
425 425
426 folder_combo_model_->MaybeChangeParent( 426 folder_combo_model_->MaybeChangeParent(
427 node, gtk_combo_box_get_active(GTK_COMBO_BOX(folder_combo_))); 427 node, gtk_combo_box_get_active(GTK_COMBO_BOX(folder_combo_)));
428 } 428 }
429 } 429 }
430 430
431 std::string BookmarkBubbleGtk::GetTitle() { 431 std::string BookmarkBubbleGtk::GetTitle() {
432 const BookmarkNode* node = model_->GetMostRecentlyAddedNodeForURL(url_); 432 const BookmarkNode* node = model_->GetMostRecentlyAddedNodeForURL(url_);
433 if (!node) { 433 if (!node) {
434 NOTREACHED(); 434 NOTREACHED();
435 return std::string(); 435 return std::string();
436 } 436 }
437 437
438 return UTF16ToUTF8(node->GetTitle()); 438 return base::UTF16ToUTF8(node->GetTitle());
439 } 439 }
440 440
441 void BookmarkBubbleGtk::ShowEditor() { 441 void BookmarkBubbleGtk::ShowEditor() {
442 const BookmarkNode* node = model_->GetMostRecentlyAddedNodeForURL(url_); 442 const BookmarkNode* node = model_->GetMostRecentlyAddedNodeForURL(url_);
443 443
444 // Commit any edits now. 444 // Commit any edits now.
445 ApplyEdits(); 445 ApplyEdits();
446 446
447 // Closing might delete us, so we'll cache what we need on the stack. 447 // Closing might delete us, so we'll cache what we need on the stack.
448 Profile* profile = profile_; 448 Profile* profile = profile_;
(...skipping 17 matching lines...) Expand all
466 466
467 GtkListStore* store = gtk_list_store_new(COLUMN_COUNT, 467 GtkListStore* store = gtk_list_store_new(COLUMN_COUNT,
468 G_TYPE_STRING, G_TYPE_BOOLEAN); 468 G_TYPE_STRING, G_TYPE_BOOLEAN);
469 469
470 // We always have nodes + 1 entries in the combo. The last entry is an entry 470 // We always have nodes + 1 entries in the combo. The last entry is an entry
471 // that reads 'Choose Another Folder...' and when chosen Bookmark Editor is 471 // that reads 'Choose Another Folder...' and when chosen Bookmark Editor is
472 // opened. 472 // opened.
473 for (int i = 0; i < folder_combo_model_->GetItemCount(); ++i) { 473 for (int i = 0; i < folder_combo_model_->GetItemCount(); ++i) {
474 const bool is_separator = folder_combo_model_->IsItemSeparatorAt(i); 474 const bool is_separator = folder_combo_model_->IsItemSeparatorAt(i);
475 const std::string name = is_separator ? 475 const std::string name = is_separator ?
476 std::string() : UTF16ToUTF8(folder_combo_model_->GetItemAt(i)); 476 std::string() : base::UTF16ToUTF8(folder_combo_model_->GetItemAt(i));
477 477
478 GtkTreeIter iter; 478 GtkTreeIter iter;
479 gtk_list_store_append(store, &iter); 479 gtk_list_store_append(store, &iter);
480 gtk_list_store_set(store, &iter, 480 gtk_list_store_set(store, &iter,
481 COLUMN_NAME, name.c_str(), 481 COLUMN_NAME, name.c_str(),
482 COLUMN_IS_SEPARATOR, is_separator, 482 COLUMN_IS_SEPARATOR, is_separator,
483 -1); 483 -1);
484 } 484 }
485 485
486 folder_combo_ = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); 486 folder_combo_ = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
487 487
488 gtk_combo_box_set_active(GTK_COMBO_BOX(folder_combo_), 488 gtk_combo_box_set_active(GTK_COMBO_BOX(folder_combo_),
489 folder_combo_model_->GetDefaultIndex()); 489 folder_combo_model_->GetDefaultIndex());
490 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(folder_combo_), 490 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(folder_combo_),
491 IsSeparator, NULL, NULL); 491 IsSeparator, NULL, NULL);
492 g_object_unref(store); 492 g_object_unref(store);
493 493
494 GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); 494 GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
495 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(folder_combo_), renderer, TRUE); 495 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(folder_combo_), renderer, TRUE);
496 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(folder_combo_), renderer, 496 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(folder_combo_), renderer,
497 "text", COLUMN_NAME, 497 "text", COLUMN_NAME,
498 NULL); 498 NULL);
499 } 499 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_unittest.cc ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698