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

Unified Diff: chrome/browser/ui/search/search_model.cc

Issue 2885853002: Instant: remove InstantSupportState (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/search/search_model.h ('k') | chrome/browser/ui/search/search_model_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/search_model.cc
diff --git a/chrome/browser/ui/search/search_model.cc b/chrome/browser/ui/search/search_model.cc
index 5d4e31d6190ffe7726f897e0faae19b5960f3d55..2e1498f63ca68b07bf3e06cd5de7c399cd9661c6 100644
--- a/chrome/browser/ui/search/search_model.cc
+++ b/chrome/browser/ui/search/search_model.cc
@@ -7,64 +7,23 @@
#include "chrome/browser/ui/search/search_model_observer.h"
#include "components/search/search.h"
-SearchModel::State::State() : instant_support(INSTANT_SUPPORT_NO) {}
+SearchModel::SearchModel() = default;
-SearchModel::State::State(const SearchMode& mode,
- InstantSupportState instant_support)
- : mode(mode), instant_support(instant_support) {}
-
-bool SearchModel::State::operator==(const State& rhs) const {
- return mode == rhs.mode && instant_support == rhs.instant_support;
-}
-
-SearchModel::SearchModel() {
-}
-
-SearchModel::~SearchModel() {
-}
-
-void SearchModel::SetState(const State& new_state) {
- DCHECK(search::IsInstantExtendedAPIEnabled())
- << "Please do not try to set the SearchModel mode without first "
- << "checking if Search is enabled.";
-
- if (state_ == new_state)
- return;
-
- const State old_state = state_;
- state_ = new_state;
-
- for (SearchModelObserver& observer : observers_)
- observer.ModelChanged(old_state, state_);
-}
+SearchModel::~SearchModel() = default;
void SearchModel::SetMode(const SearchMode& new_mode) {
DCHECK(search::IsInstantExtendedAPIEnabled())
<< "Please do not try to set the SearchModel mode without first "
<< "checking if Search is enabled.";
- if (state_.mode == new_mode)
+ if (mode_ == new_mode)
return;
- const State old_state = state_;
- state_.mode = new_mode;
-
- for (SearchModelObserver& observer : observers_)
- observer.ModelChanged(old_state, state_);
-}
-
-void SearchModel::SetInstantSupportState(InstantSupportState instant_support) {
- DCHECK(search::IsInstantExtendedAPIEnabled())
- << "Please do not try to set the SearchModel state without first "
- << "checking if Search is enabled.";
-
- if (state_.instant_support == instant_support)
- return;
+ const SearchMode old_mode = mode_;
+ mode_ = new_mode;
- const State old_state = state_;
- state_.instant_support = instant_support;
for (SearchModelObserver& observer : observers_)
- observer.ModelChanged(old_state, state_);
+ observer.ModelChanged(old_mode, mode_);
}
void SearchModel::AddObserver(SearchModelObserver* observer) {
« no previous file with comments | « chrome/browser/ui/search/search_model.h ('k') | chrome/browser/ui/search/search_model_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698