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