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

Side by Side Diff: chrome/browser/ui/views/toolbar/home_button.cc

Issue 2014733003: Removing parsing of text from pasteboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moving url parsing up the hierarchy Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/views/toolbar/home_button.h" 5 #include "chrome/browser/ui/views/toolbar/home_button.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 bool HomeButton::GetDropFormats( 154 bool HomeButton::GetDropFormats(
155 int* formats, 155 int* formats,
156 std::set<ui::Clipboard::FormatType>* format_types) { 156 std::set<ui::Clipboard::FormatType>* format_types) {
157 *formats = ui::OSExchangeData::URL; 157 *formats = ui::OSExchangeData::URL;
158 return true; 158 return true;
159 } 159 }
160 160
161 bool HomeButton::CanDrop(const OSExchangeData& data) { 161 bool HomeButton::CanDrop(const OSExchangeData& data) {
162 return data.HasURL(ui::OSExchangeData::CONVERT_FILENAMES); 162 return data.HasURL(ui::OSExchangeData::CONVERT_FILENAMES,
163 ui::OSExchangeData::PARSE_TEXT_AS_URL);
163 } 164 }
164 165
165 int HomeButton::OnDragUpdated(const ui::DropTargetEvent& event) { 166 int HomeButton::OnDragUpdated(const ui::DropTargetEvent& event) {
166 return event.source_operations(); 167 return event.source_operations();
167 } 168 }
168 169
169 int HomeButton::OnPerformDrop(const ui::DropTargetEvent& event) { 170 int HomeButton::OnPerformDrop(const ui::DropTargetEvent& event) {
170 GURL new_homepage_url; 171 GURL new_homepage_url;
171 base::string16 title; 172 base::string16 title;
172 if (event.data().GetURLAndTitle( 173 if (event.data().GetURLAndTitle(ui::OSExchangeData::CONVERT_FILENAMES,
173 ui::OSExchangeData::CONVERT_FILENAMES, &new_homepage_url, &title) && 174 ui::OSExchangeData::PARSE_TEXT_AS_URL,
175 &new_homepage_url, &title) &&
174 new_homepage_url.is_valid()) { 176 new_homepage_url.is_valid()) {
175 PrefService* prefs = browser_->profile()->GetPrefs(); 177 PrefService* prefs = browser_->profile()->GetPrefs();
176 bool old_is_ntp = prefs->GetBoolean(prefs::kHomePageIsNewTabPage); 178 bool old_is_ntp = prefs->GetBoolean(prefs::kHomePageIsNewTabPage);
177 GURL old_homepage(prefs->GetString(prefs::kHomePage)); 179 GURL old_homepage(prefs->GetString(prefs::kHomePage));
178 180
179 prefs->SetBoolean(prefs::kHomePageIsNewTabPage, false); 181 prefs->SetBoolean(prefs::kHomePageIsNewTabPage, false);
180 prefs->SetString(prefs::kHomePage, new_homepage_url.spec()); 182 prefs->SetString(prefs::kHomePage, new_homepage_url.spec());
181 183
182 HomePageUndoBubble::ShowBubble(browser_, old_is_ntp, old_homepage, this); 184 HomePageUndoBubble::ShowBubble(browser_, old_is_ntp, old_homepage, this);
183 } 185 }
184 return ui::DragDropTypes::DRAG_NONE; 186 return ui::DragDropTypes::DRAG_NONE;
185 } 187 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698