OLD | NEW |
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/search/search.h" | 5 #include "chrome/browser/search/search.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 289 } |
290 | 290 |
291 bool ShouldAssignURLToInstantRenderer(const GURL& url, Profile* profile) { | 291 bool ShouldAssignURLToInstantRenderer(const GURL& url, Profile* profile) { |
292 return url.is_valid() && | 292 return url.is_valid() && |
293 profile && | 293 profile && |
294 IsInstantExtendedAPIEnabled() && | 294 IsInstantExtendedAPIEnabled() && |
295 (url.SchemeIs(chrome::kChromeSearchScheme) || | 295 (url.SchemeIs(chrome::kChromeSearchScheme) || |
296 IsInstantURL(url, profile)); | 296 IsInstantURL(url, profile)); |
297 } | 297 } |
298 | 298 |
| 299 bool ShouldInstantURLUseProcessPerSite(const GURL& url, Profile* profile) { |
| 300 return ShouldAssignURLToInstantRenderer(url, profile) && |
| 301 (url.host() == chrome::kChromeSearchLocalNtpHost || |
| 302 url.host() == chrome::kChromeSearchOnlineNtpHost); |
| 303 } |
| 304 |
299 bool IsInstantNTP(const content::WebContents* contents) { | 305 bool IsInstantNTP(const content::WebContents* contents) { |
300 if (!contents) | 306 if (!contents) |
301 return false; | 307 return false; |
302 | 308 |
303 return NavEntryIsInstantNTP(contents, | 309 return NavEntryIsInstantNTP(contents, |
304 contents->GetController().GetVisibleEntry()); | 310 contents->GetController().GetVisibleEntry()); |
305 } | 311 } |
306 | 312 |
307 bool NavEntryIsInstantNTP(const content::WebContents* contents, | 313 bool NavEntryIsInstantNTP(const content::WebContents* contents, |
308 const content::NavigationEntry* entry) { | 314 const content::NavigationEntry* entry) { |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 bool default_value, | 556 bool default_value, |
551 const FieldTrialFlags& flags) { | 557 const FieldTrialFlags& flags) { |
552 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); | 558 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); |
553 } | 559 } |
554 | 560 |
555 void ResetInstantExtendedOptInStateGateForTest() { | 561 void ResetInstantExtendedOptInStateGateForTest() { |
556 instant_extended_opt_in_state_gate = false; | 562 instant_extended_opt_in_state_gate = false; |
557 } | 563 } |
558 | 564 |
559 } // namespace chrome | 565 } // namespace chrome |
OLD | NEW |