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

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

Issue 2738003002: Add title to current page in zero suggest. (Closed)
Patch Set: Remove debugging info. Created 3 years, 7 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/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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/app/chrome_command_ids.h" 16 #include "chrome/app/chrome_command_ids.h"
16 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 17 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
17 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" 18 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h"
18 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" 19 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h"
19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 20 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
20 #include "chrome/browser/bookmarks/bookmark_stats.h" 21 #include "chrome/browser/bookmarks/bookmark_stats.h"
21 #include "chrome/browser/command_updater.h" 22 #include "chrome/browser/command_updater.h"
22 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" 23 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h"
23 #include "chrome/browser/net/predictor.h" 24 #include "chrome/browser/net/predictor.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 bool ChromeOmniboxClient::CurrentPageExists() const { 145 bool ChromeOmniboxClient::CurrentPageExists() const {
145 return (controller_->GetWebContents() != nullptr); 146 return (controller_->GetWebContents() != nullptr);
146 } 147 }
147 148
148 const GURL& ChromeOmniboxClient::GetURL() const { 149 const GURL& ChromeOmniboxClient::GetURL() const {
149 return CurrentPageExists() ? controller_->GetWebContents()->GetVisibleURL() 150 return CurrentPageExists() ? controller_->GetWebContents()->GetVisibleURL()
150 : GURL::EmptyGURL(); 151 : GURL::EmptyGURL();
151 } 152 }
152 153
153 const base::string16& ChromeOmniboxClient::GetTitle() const { 154 const base::string16& ChromeOmniboxClient::GetTitle() const {
154 return controller_->GetWebContents()->GetTitle(); 155 return CurrentPageExists() ? controller_->GetWebContents()->GetTitle()
156 : base::EmptyString16();
155 } 157 }
156 158
157 gfx::Image ChromeOmniboxClient::GetFavicon() const { 159 gfx::Image ChromeOmniboxClient::GetFavicon() const {
158 return favicon::ContentFaviconDriver::FromWebContents( 160 return favicon::ContentFaviconDriver::FromWebContents(
159 controller_->GetWebContents()) 161 controller_->GetWebContents())
160 ->GetFavicon(); 162 ->GetFavicon();
161 } 163 }
162 164
163 bool ChromeOmniboxClient::IsInstantNTP() const { 165 bool ChromeOmniboxClient::IsInstantNTP() const {
164 return search::IsInstantNTP(controller_->GetWebContents()); 166 return search::IsInstantNTP(controller_->GetWebContents());
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 InstantSearchPrerenderer::GetForProfile(profile_); 498 InstantSearchPrerenderer::GetForProfile(profile_);
497 if (prerenderer) 499 if (prerenderer)
498 prerenderer->Prerender(suggestion); 500 prerenderer->Prerender(suggestion);
499 } 501 }
500 502
501 void ChromeOmniboxClient::OnBitmapFetched(const BitmapFetchedCallback& callback, 503 void ChromeOmniboxClient::OnBitmapFetched(const BitmapFetchedCallback& callback,
502 const SkBitmap& bitmap) { 504 const SkBitmap& bitmap) {
503 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID; 505 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID;
504 callback.Run(bitmap); 506 callback.Run(bitmap);
505 } 507 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698