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