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

Unified Diff: chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc

Issue 7310023: Pre-fill the 'Add Page' bookmark window with the current page (gtk and windows). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc
index 9e0b4e75a8d0ab683e26e10ec60557cb3f346d9d..4ba1443a9eb5172e0991fccd22438d983cc2205e 100644
--- a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc
@@ -15,10 +15,13 @@
#include "chrome/browser/history/history.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.h"
#include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
#include "chrome/browser/ui/gtk/gtk_theme_service.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
+#include "content/browser/tab_contents/tab_contents.h"
#include "googleurl/src/gurl.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -276,10 +279,20 @@ void BookmarkEditorGtk::Init(GtkWindow* parent_window) {
name_entry_ = gtk_entry_new();
std::string title;
+ std::string url_spec;
if (details_.type == EditDetails::EXISTING_NODE) {
title = UTF16ToUTF8(details_.existing_node->GetTitle());
+ url_spec = details_.existing_node->GetURL().spec();
} else if (details_.type == EditDetails::NEW_FOLDER) {
title = l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME);
+ } else if (details_.type == EditDetails::NEW_URL) {
+ Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
sky 2011/07/07 16:02:50 Move this off into bookmark_utils so you don't nee
sadrul 2011/07/07 16:37:38 Nice! I wasn't aware of bookmark_utils. Done. Than
+ TabContents* tab_contents = browser ? browser->GetSelectedTabContents()
+ : NULL;
+ if (tab_contents) {
+ title = UTF16ToUTF8(tab_contents->GetTitle());
+ url_spec = tab_contents->GetURL().spec();
+ }
}
gtk_entry_set_text(GTK_ENTRY(name_entry_), title.c_str());
g_signal_connect(name_entry_, "changed",
@@ -289,9 +302,6 @@ void BookmarkEditorGtk::Init(GtkWindow* parent_window) {
GtkWidget* table;
if (details_.type != EditDetails::NEW_FOLDER) {
url_entry_ = gtk_entry_new();
- std::string url_spec;
- if (details_.type == EditDetails::EXISTING_NODE)
- url_spec = details_.existing_node->GetURL().spec();
gtk_entry_set_text(GTK_ENTRY(url_entry_), url_spec.c_str());
g_signal_connect(url_entry_, "changed",
G_CALLBACK(OnEntryChangedThunk), this);
« no previous file with comments | « no previous file | chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698