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

Side by Side Diff: chrome/browser/ui/search/search_tab_helper.cc

Issue 2485253002: Remove unnecessary calls to GURL() (Closed)
Patch Set: Assert that StringPiece must always be canonicalized. Fix some constants. 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/search/search_tab_helper.h" 5 #include "chrome/browser/ui/search/search_tab_helper.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "url/gurl.h" 52 #include "url/gurl.h"
53 53
54 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SearchTabHelper); 54 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SearchTabHelper);
55 55
56 namespace { 56 namespace {
57 57
58 bool IsCacheableNTP(const content::WebContents* contents) { 58 bool IsCacheableNTP(const content::WebContents* contents) {
59 const content::NavigationEntry* entry = 59 const content::NavigationEntry* entry =
60 contents->GetController().GetLastCommittedEntry(); 60 contents->GetController().GetLastCommittedEntry();
61 return search::NavEntryIsInstantNTP(contents, entry) && 61 return search::NavEntryIsInstantNTP(contents, entry) &&
62 entry->GetURL() != GURL(chrome::kChromeSearchLocalNtpUrl); 62 entry->GetURL() != chrome::kChromeSearchLocalNtpUrl;
63 } 63 }
64 64
65 bool IsNTP(const content::WebContents* contents) { 65 bool IsNTP(const content::WebContents* contents) {
66 // We can't use WebContents::GetURL() because that uses the active entry, 66 // We can't use WebContents::GetURL() because that uses the active entry,
67 // whereas we want the visible entry. 67 // whereas we want the visible entry.
68 const content::NavigationEntry* entry = 68 const content::NavigationEntry* entry =
69 contents->GetController().GetVisibleEntry(); 69 contents->GetController().GetVisibleEntry();
70 if (entry && entry->GetVirtualURL() == chrome::kChromeUINewTabURL) 70 if (entry && entry->GetVirtualURL() == chrome::kChromeUINewTabURL)
71 return true; 71 return true;
72 72
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 500
501 bool SearchTabHelper::IsInputInProgress() const { 501 bool SearchTabHelper::IsInputInProgress() const {
502 OmniboxView* omnibox = GetOmniboxView(); 502 OmniboxView* omnibox = GetOmniboxView();
503 return !model_.mode().is_ntp() && omnibox && 503 return !model_.mode().is_ntp() && omnibox &&
504 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; 504 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE;
505 } 505 }
506 506
507 OmniboxView* SearchTabHelper::GetOmniboxView() const { 507 OmniboxView* SearchTabHelper::GetOmniboxView() const {
508 return delegate_ ? delegate_->GetOmniboxView() : NULL; 508 return delegate_ ? delegate_->GetOmniboxView() : NULL;
509 } 509 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698