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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_editor_view.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 | « chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
index 04056babe7726dfe3f2c04ec328c8118570b1f69..5046fb6945a4a8bfe740a266c0aff11a976ae855 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
@@ -267,11 +267,19 @@ void BookmarkEditorView::Init() {
title_tf_.set_parent_owned(false);
std::wstring title;
- if (details_.type == EditDetails::EXISTING_NODE)
+ GURL url;
+ if (details_.type == EditDetails::EXISTING_NODE) {
title = details_.existing_node->GetTitle();
- else if (details_.type == EditDetails::NEW_FOLDER)
+ url = details_.existing_node->GetURL();
+ } else if (details_.type == EditDetails::NEW_FOLDER) {
title = UTF16ToWide(
l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME));
+ } else if (details_.type == EditDetails::NEW_URL) {
+ string16 title16;
+ bookmark_utils::GetURLAndTitleToBookmarkFromCurrentTab(profile_,
+ &url, &title16);
+ title = UTF16ToWide(title16);
+ }
title_tf_.SetText(title);
title_tf_.SetController(this);
@@ -280,14 +288,14 @@ void BookmarkEditorView::Init() {
title_tf_.SetAccessibleName(WideToUTF16Hack(title_label_->GetText()));
string16 url_text;
- if (details_.type == EditDetails::EXISTING_NODE) {
+ if (details_.type != EditDetails::NEW_FOLDER) {
std::string languages = profile_
? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)
: std::string();
// Because this gets parsed by FixupURL(), it's safe to omit the scheme or
// trailing slash, and unescape most characters, but we need to not drop any
// username/password, or unescape anything that changes the meaning.
- url_text = net::FormatUrl(details_.existing_node->GetURL(), languages,
+ url_text = net::FormatUrl(url, languages,
net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword,
UnescapeRule::SPACES, NULL, NULL, NULL);
}
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698