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

Side by Side Diff: chrome/browser/ui/omnibox/chrome_omnibox_client.cc

Issue 2435103002: Omnibox: Preserve display text and select all on a focus search (Closed)
Patch Set: Use display_text.length() as caret pos for KEYBOARD_SHORTCUT Created 4 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
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/omnibox/chrome_omnibox_client.h" 5 #include "chrome/browser/ui/omnibox/chrome_omnibox_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 std::unique_ptr<OmniboxNavigationObserver> 133 std::unique_ptr<OmniboxNavigationObserver>
134 ChromeOmniboxClient::CreateOmniboxNavigationObserver( 134 ChromeOmniboxClient::CreateOmniboxNavigationObserver(
135 const base::string16& text, 135 const base::string16& text,
136 const AutocompleteMatch& match, 136 const AutocompleteMatch& match,
137 const AutocompleteMatch& alternate_nav_match) { 137 const AutocompleteMatch& alternate_nav_match) {
138 return base::MakeUnique<ChromeOmniboxNavigationObserver>( 138 return base::MakeUnique<ChromeOmniboxNavigationObserver>(
139 profile_, text, match, alternate_nav_match); 139 profile_, text, match, alternate_nav_match);
140 } 140 }
141 141
142 bool ChromeOmniboxClient::CurrentPageExists() const { 142 bool ChromeOmniboxClient::CurrentPageExists() const {
143 return (controller_->GetWebContents() != NULL); 143 return (controller_->GetWebContents() != nullptr);
144 } 144 }
145 145
146 const GURL& ChromeOmniboxClient::GetURL() const { 146 const GURL& ChromeOmniboxClient::GetURL() const {
147 return controller_->GetWebContents()->GetVisibleURL(); 147 return CurrentPageExists() ? controller_->GetWebContents()->GetVisibleURL()
148 : GURL::EmptyGURL();
148 } 149 }
149 150
150 const base::string16& ChromeOmniboxClient::GetTitle() const { 151 const base::string16& ChromeOmniboxClient::GetTitle() const {
151 return controller_->GetWebContents()->GetTitle(); 152 return controller_->GetWebContents()->GetTitle();
152 } 153 }
153 154
154 gfx::Image ChromeOmniboxClient::GetFavicon() const { 155 gfx::Image ChromeOmniboxClient::GetFavicon() const {
155 return favicon::ContentFaviconDriver::FromWebContents( 156 return favicon::ContentFaviconDriver::FromWebContents(
156 controller_->GetWebContents()) 157 controller_->GetWebContents())
157 ->GetFavicon(); 158 ->GetFavicon();
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 InstantSearchPrerenderer::GetForProfile(profile_); 452 InstantSearchPrerenderer::GetForProfile(profile_);
452 if (prerenderer) 453 if (prerenderer)
453 prerenderer->Prerender(suggestion); 454 prerenderer->Prerender(suggestion);
454 } 455 }
455 456
456 void ChromeOmniboxClient::OnBitmapFetched(const BitmapFetchedCallback& callback, 457 void ChromeOmniboxClient::OnBitmapFetched(const BitmapFetchedCallback& callback,
457 const SkBitmap& bitmap) { 458 const SkBitmap& bitmap) {
458 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID; 459 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID;
459 callback.Run(bitmap); 460 callback.Run(bitmap);
460 } 461 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm ('k') | chrome/browser/ui/omnibox/omnibox_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698