Chromium Code Reviews| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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(); |
|
Peter Kasting
2016/10/25 20:21:27
This doesn't produce a "forcing to true/false (per
Tom (Use chromium acct)
2016/10/25 21:55:09
idk, I didn't run a dry run on this PS.
Reverted j
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |