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

Side by Side Diff: chrome/browser/views/frame/browser_root_view.cc

Issue 347020: BrowserRootView: rewritten the GetPasteAndGoUrl function.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/frame/browser_root_view.h" 5 #include "chrome/browser/views/frame/browser_root_view.h"
6 6
7 #include "app/drag_drop_types.h" 7 #include "app/drag_drop_types.h"
8 #include "app/os_exchange_data.h" 8 #include "app/os_exchange_data.h"
9 #include "chrome/browser/autocomplete/autocomplete_edit.h"
10 #include "chrome/browser/autocomplete/autocomplete_edit_view.h"
11 #include "chrome/browser/location_bar.h" 9 #include "chrome/browser/location_bar.h"
10 #include "chrome/browser/profile.h"
11 #include "chrome/browser/search_versus_navigate_classifier.h"
12 #include "chrome/browser/views/frame/browser_view.h" 12 #include "chrome/browser/views/frame/browser_view.h"
13 #include "chrome/browser/views/frame/browser_frame.h" 13 #include "chrome/browser/views/frame/browser_frame.h"
14 #include "chrome/browser/views/tabs/tab_strip_wrapper.h" 14 #include "chrome/browser/views/tabs/tab_strip_wrapper.h"
15 15
16 BrowserRootView::BrowserRootView(BrowserView* browser_view, 16 BrowserRootView::BrowserRootView(BrowserView* browser_view,
17 views::Widget* widget) 17 views::Widget* widget)
18 : views::RootView(widget), 18 : views::RootView(widget),
19 browser_view_(browser_view), 19 browser_view_(browser_view),
20 forwarding_to_tab_strip_(false) { 20 forwarding_to_tab_strip_(false) {
21 } 21 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 TabStripWrapper* BrowserRootView::tabstrip() const { 131 TabStripWrapper* BrowserRootView::tabstrip() const {
132 return browser_view_->tabstrip(); 132 return browser_view_->tabstrip();
133 } 133 }
134 134
135 bool BrowserRootView::GetPasteAndGoURL(const OSExchangeData& data, 135 bool BrowserRootView::GetPasteAndGoURL(const OSExchangeData& data,
136 GURL* url) { 136 GURL* url) {
137 if (!data.HasString()) 137 if (!data.HasString())
138 return false; 138 return false;
139 139
140 LocationBar* location_bar = browser_view_->GetLocationBar(); 140 std::wstring text;
141 if (!location_bar) 141 if (!data.GetString(&text) || text.empty())
142 return false; 142 return false;
143 143
144 AutocompleteEditView* edit = location_bar->location_entry(); 144 Profile* profile = browser_view_->browser()->profile();
145 if (!edit) 145 SearchVersusNavigateClassifier* classifier =
146 profile->GetSearchVersusNavigateClassifier();
147
148 GURL destination_url;
149 classifier->Classify(text, std::wstring(), NULL, &destination_url, NULL, NULL,
150 NULL);
151
152 if (!destination_url.is_valid())
146 return false; 153 return false;
147
148 std::wstring text;
149 if (!data.GetString(&text) || text.empty() ||
150 !edit->model()->CanPasteAndGo(text)) {
151 return false;
152 }
153 if (url) 154 if (url)
154 *url = edit->model()->paste_and_go_url(); 155 *url = destination_url;
155 return true; 156 return true;
156 } 157 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698