| 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/instant/search.h" | 5 #include "chrome/browser/instant/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" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
| 13 #include "chrome/browser/instant/instant_service.h" | 13 #include "chrome/browser/instant/instant_service.h" |
| 14 #include "chrome/browser/instant/instant_service_factory.h" | 14 #include "chrome/browser/instant/instant_service_factory.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/search_engines/template_url_service.h" | 16 #include "chrome/browser/search_engines/template_url_service.h" |
| 17 #include "chrome/browser/search_engines/template_url_service_factory.h" | 17 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/common/search_types.h" |
| 20 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
| 21 #include "components/user_prefs/pref_registry_syncable.h" | 22 #include "components/user_prefs/pref_registry_syncable.h" |
| 22 #include "content/public/browser/navigation_entry.h" | 23 #include "content/public/browser/navigation_entry.h" |
| 23 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
| 24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 25 | 26 |
| 26 namespace chrome { | 27 namespace chrome { |
| 27 namespace search { | 28 namespace search { |
| 28 | 29 |
| 29 namespace { | 30 namespace { |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 const std::string search_path = search_url.path(); | 516 const std::string search_path = search_url.path(); |
| 516 | 517 |
| 517 GURL::Replacements replacements; | 518 GURL::Replacements replacements; |
| 518 replacements.SetSchemeStr(search_scheme); | 519 replacements.SetSchemeStr(search_scheme); |
| 519 replacements.SetHostStr(search_host); | 520 replacements.SetHostStr(search_host); |
| 520 replacements.SetPortStr(search_port); | 521 replacements.SetPortStr(search_port); |
| 521 replacements.SetPathStr(search_path); | 522 replacements.SetPathStr(search_path); |
| 522 return instant_url.ReplaceComponents(replacements); | 523 return instant_url.ReplaceComponents(replacements); |
| 523 } | 524 } |
| 524 | 525 |
| 526 bool ShouldHandleTopBarsVisibilityChange(const Mode& old_mode, |
| 527 const Mode& new_mode) { |
| 528 // If mode has changed, only handle top bars visibility change if new mode |
| 529 // is not |SEARCH_SUGGESTIONS| or |SEARCH_RESULTS|. Top bars visibility for |
| 530 // these 2 modes is determined when the mode stays the same, and: |
| 531 // - for |NTP/SERP| pages: by SearchBox API, or |
| 532 // - for |DEFAULT| pages: by platform-specific implementation of |
| 533 // |InstantOverlayController| when it shows/hides the Instant overlay. |
| 534 return old_mode != new_mode ? !new_mode.is_search() : new_mode.is_search(); |
| 535 } |
| 536 |
| 525 } // namespace search | 537 } // namespace search |
| 526 } // namespace chrome | 538 } // namespace chrome |
| OLD | NEW |