| 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 #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/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 return UTF16ToUTF8(node->GetTitle()); | 302 return UTF16ToUTF8(node->GetTitle()); |
| 303 } | 303 } |
| 304 | 304 |
| 305 void BookmarkBubbleGtk::ShowEditor() { | 305 void BookmarkBubbleGtk::ShowEditor() { |
| 306 const BookmarkNode* node = | 306 const BookmarkNode* node = |
| 307 profile_->GetBookmarkModel()->GetMostRecentlyAddedNodeForURL(url_); | 307 profile_->GetBookmarkModel()->GetMostRecentlyAddedNodeForURL(url_); |
| 308 | 308 |
| 309 // Commit any edits now. | 309 // Commit any edits now. |
| 310 ApplyEdits(); | 310 ApplyEdits(); |
| 311 | 311 |
| 312 #if !defined(WEBUI_DIALOGS) | |
| 313 // Closing might delete us, so we'll cache what we need on the stack. | 312 // Closing might delete us, so we'll cache what we need on the stack. |
| 314 Profile* profile = profile_; | 313 Profile* profile = profile_; |
| 315 GtkWindow* toplevel = GTK_WINDOW(gtk_widget_get_toplevel(anchor_)); | 314 GtkWindow* toplevel = GTK_WINDOW(gtk_widget_get_toplevel(anchor_)); |
| 316 #endif | |
| 317 | 315 |
| 318 // Close the bubble, deleting the C++ objects, etc. | 316 // Close the bubble, deleting the C++ objects, etc. |
| 319 bubble_->Close(); | 317 bubble_->Close(); |
| 320 | 318 |
| 321 if (node) { | 319 if (node) { |
| 322 #if defined(WEBUI_DIALOGS) | 320 BookmarkEditor::Show(toplevel, profile, |
| 323 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); | 321 BookmarkEditor::EditDetails::EditNode(node), |
| 324 DCHECK(browser); | |
| 325 browser->OpenBookmarkManagerEditNode(node->id()); | |
| 326 #else | |
| 327 BookmarkEditor::Show(toplevel, profile, NULL, | |
| 328 BookmarkEditor::EditDetails(node), | |
| 329 BookmarkEditor::SHOW_TREE); | 322 BookmarkEditor::SHOW_TREE); |
| 330 #endif | |
| 331 } | 323 } |
| 332 } | 324 } |
| 333 | 325 |
| 334 void BookmarkBubbleGtk::InitFolderComboModel() { | 326 void BookmarkBubbleGtk::InitFolderComboModel() { |
| 335 const BookmarkNode* node = | 327 const BookmarkNode* node = |
| 336 profile_->GetBookmarkModel()->GetMostRecentlyAddedNodeForURL(url_); | 328 profile_->GetBookmarkModel()->GetMostRecentlyAddedNodeForURL(url_); |
| 337 DCHECK(node); | 329 DCHECK(node); |
| 338 | 330 |
| 339 folder_combo_model_.reset(new RecentlyUsedFoldersComboModel( | 331 folder_combo_model_.reset(new RecentlyUsedFoldersComboModel( |
| 340 profile_->GetBookmarkModel(), node)); | 332 profile_->GetBookmarkModel(), node)); |
| 341 | 333 |
| 342 // We always have nodes + 1 entries in the combo. The last entry will be | 334 // We always have nodes + 1 entries in the combo. The last entry will be |
| 343 // the 'Select another folder...' entry that opens the bookmark editor. | 335 // the 'Select another folder...' entry that opens the bookmark editor. |
| 344 for (int i = 0; i < folder_combo_model_->GetItemCount(); ++i) { | 336 for (int i = 0; i < folder_combo_model_->GetItemCount(); ++i) { |
| 345 gtk_combo_box_append_text(GTK_COMBO_BOX(folder_combo_), | 337 gtk_combo_box_append_text(GTK_COMBO_BOX(folder_combo_), |
| 346 UTF16ToUTF8(folder_combo_model_->GetItemAt(i)).c_str()); | 338 UTF16ToUTF8(folder_combo_model_->GetItemAt(i)).c_str()); |
| 347 } | 339 } |
| 348 | 340 |
| 349 gtk_combo_box_set_active(GTK_COMBO_BOX(folder_combo_), | 341 gtk_combo_box_set_active(GTK_COMBO_BOX(folder_combo_), |
| 350 folder_combo_model_->node_parent_index()); | 342 folder_combo_model_->node_parent_index()); |
| 351 } | 343 } |
| OLD | NEW |