OLD | NEW |
---|---|
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 bool ChromeOmniboxClient::CurrentPageExists() const { | 144 bool ChromeOmniboxClient::CurrentPageExists() const { |
145 return (controller_->GetWebContents() != nullptr); | 145 return (controller_->GetWebContents() != nullptr); |
146 } | 146 } |
147 | 147 |
148 const GURL& ChromeOmniboxClient::GetURL() const { | 148 const GURL& ChromeOmniboxClient::GetURL() const { |
149 return CurrentPageExists() ? controller_->GetWebContents()->GetVisibleURL() | 149 return CurrentPageExists() ? controller_->GetWebContents()->GetVisibleURL() |
150 : GURL::EmptyGURL(); | 150 : GURL::EmptyGURL(); |
151 } | 151 } |
152 | 152 |
153 const base::string16& ChromeOmniboxClient::GetTitle() const { | 153 const base::string16& ChromeOmniboxClient::GetTitle() const { |
154 return controller_->GetWebContents()->GetTitle(); | 154 static const auto* const kEmptyTitle = new base::string16(); |
Peter Kasting
2017/04/27 00:33:57
Don't do this; return EmptyString16() below instea
gcomanici
2017/04/27 02:11:23
Done.
| |
155 return CurrentPageExists() ? controller_->GetWebContents()->GetTitle() | |
156 : *kEmptyTitle; | |
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 Loading... | |
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 } |
OLD | NEW |