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

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_model_impl.cc

Issue 14080004: Remove some chrome-specific methods from content::WebUI. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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/toolbar/toolbar_model_impl.h" 5 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 return GURL(chrome::kAboutBlankURL); 140 return GURL(chrome::kAboutBlankURL);
141 } 141 }
142 142
143 bool ToolbarModelImpl::WouldReplaceSearchURLWithSearchTerms() const { 143 bool ToolbarModelImpl::WouldReplaceSearchURLWithSearchTerms() const {
144 return !GetSearchTerms().empty(); 144 return !GetSearchTerms().empty();
145 } 145 }
146 146
147 bool ToolbarModelImpl::ShouldDisplayURL() const { 147 bool ToolbarModelImpl::ShouldDisplayURL() const {
148 // Note: The order here is important. 148 // Note: The order here is important.
149 // - The WebUI test must come before the extension scheme test because there 149 // - The NTP test must come before the extension scheme test because there
150 // can be WebUIs that have extension schemes (e.g. the bookmark manager). In 150 // can be NTPs that have extension schemes (e.g. the bookmark manager). In
Avi (use Gerrit) 2013/04/10 23:12:15 "NTPs that have extension schemes"? I'm not sure a
jam 2013/04/10 23:45:35 updated comment
151 // that case, we should prefer what the WebUI instance says. 151 // that case, we should prefer what the NTP instance says.
152 // - The view-source test must come before the WebUI test because of the case 152 // - The view-source test must come before the NTP test because of the case
153 // of view-source:chrome://newtab, which should display its URL despite what 153 // of view-source:chrome://newtab, which should display its URL despite what
154 // chrome://newtab's WebUI says. 154 // chrome://newtab says.
155 NavigationController* controller = GetNavigationController(); 155 NavigationController* controller = GetNavigationController();
156 NavigationEntry* entry = controller ? controller->GetVisibleEntry() : NULL; 156 NavigationEntry* entry = controller ? controller->GetVisibleEntry() : NULL;
157 if (entry) { 157 if (entry) {
158 if (entry->IsViewSourceMode() || 158 if (entry->IsViewSourceMode() ||
159 entry->GetPageType() == content::PAGE_TYPE_INTERSTITIAL) { 159 entry->GetPageType() == content::PAGE_TYPE_INTERSTITIAL) {
160 return true; 160 return true;
161 } 161 }
162
163 if (entry->GetURL().SchemeIs(chrome::kChromeUIScheme) &&
164 (entry->GetURL().host() == chrome::kChromeUINewTabHost ||
165 entry->GetURL().host() == chrome::kChromeUIExtensionActivityHost)) {
166 return false;
167 }
168
169 if (entry->GetURL().SchemeIs(extensions::kExtensionScheme))
170 return false;
171
172 #if defined(OS_CHROMEOS)
173 if (entry->GetURL().SchemeIs(chrome::kDriveScheme))
174 return false;
175 #endif
162 } 176 }
163 177
164 WebContents* web_contents = delegate_->GetActiveWebContents(); 178 if (chrome::IsInstantNTP(delegate_->GetActiveWebContents()))
165 if (web_contents && web_contents->GetWebUIForCurrentState())
166 return !web_contents->GetWebUIForCurrentState()->ShouldHideURL();
167
168 if (entry && entry->GetURL().SchemeIs(extensions::kExtensionScheme))
169 return false;
170
171 #if defined(OS_CHROMEOS)
172 if (entry && entry->GetURL().SchemeIs(chrome::kDriveScheme))
173 return false;
174 #endif
175
176 if (chrome::IsInstantNTP(web_contents))
177 return false; 179 return false;
178 180
179 return true; 181 return true;
180 } 182 }
181 183
182 ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel() const { 184 ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel() const {
183 if (input_in_progress_) // When editing, assume no security style. 185 if (input_in_progress_) // When editing, assume no security style.
184 return NONE; 186 return NONE;
185 187
186 return GetSecurityLevelForWebContents(delegate_->GetActiveWebContents()); 188 return GetSecurityLevelForWebContents(delegate_->GetActiveWebContents());
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 Profile* profile = 263 Profile* profile =
262 Profile::FromBrowserContext(contents->GetBrowserContext()); 264 Profile::FromBrowserContext(contents->GetBrowserContext());
263 AutocompleteClassifierFactory::GetForProfile(profile)->Classify( 265 AutocompleteClassifierFactory::GetForProfile(profile)->Classify(
264 search_terms, false, false, &match, NULL); 266 search_terms, false, false, &match, NULL);
265 if (!AutocompleteMatch::IsSearchType(match.type)) 267 if (!AutocompleteMatch::IsSearchType(match.type))
266 search_terms.clear(); 268 search_terms.clear();
267 } 269 }
268 270
269 return search_terms; 271 return search_terms;
270 } 272 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698