Commit 7376bd82 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Instant: Move SearchModel and SearchDelegate out of Browser

...and into BrowserInstantController. This reduces the number of
"Instant things" that Browser has to know about from 4 to 2.

Bug: 627747
Change-Id: I1d9dbfe37bda88e59ce6fa4759f8b3a8428eaacc
Reviewed-on: https://chromium-review.googlesource.com/678502Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Reviewed-by: default avatarChris Pickel <sfiera@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504309}
parent 87175111
...@@ -126,8 +126,6 @@ ...@@ -126,8 +126,6 @@
#include "chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h" #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h"
#include "chrome/browser/ui/location_bar/location_bar.h" #include "chrome/browser/ui/location_bar/location_bar.h"
#include "chrome/browser/ui/permission_bubble/chooser_bubble_delegate.h" #include "chrome/browser/ui/permission_bubble/chooser_bubble_delegate.h"
#include "chrome/browser/ui/search/search_delegate.h"
#include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/search/search_tab_helper.h" #include "chrome/browser/ui/search/search_tab_helper.h"
#include "chrome/browser/ui/singleton_tabs.h" #include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/browser/ui/status_bubble.h" #include "chrome/browser/ui/status_bubble.h"
...@@ -409,8 +407,6 @@ Browser::Browser(const CreateParams& params) ...@@ -409,8 +407,6 @@ Browser::Browser(const CreateParams& params)
toolbar_model_.reset(new ToolbarModelImpl(toolbar_model_delegate_.get(), toolbar_model_.reset(new ToolbarModelImpl(toolbar_model_delegate_.get(),
content::kMaxURLDisplayChars)); content::kMaxURLDisplayChars));
search_model_.reset(new SearchModel());
search_delegate_.reset(new SearchDelegate(search_model_.get()));
extension_registry_observer_.Add( extension_registry_observer_.Add(
extensions::ExtensionRegistry::Get(profile_)); extensions::ExtensionRegistry::Get(profile_));
...@@ -1027,7 +1023,8 @@ void Browser::TabDetachedAt(WebContents* contents, int index) { ...@@ -1027,7 +1023,8 @@ void Browser::TabDetachedAt(WebContents* contents, int index) {
void Browser::TabDeactivated(WebContents* contents) { void Browser::TabDeactivated(WebContents* contents) {
exclusive_access_manager_->OnTabDeactivated(contents); exclusive_access_manager_->OnTabDeactivated(contents);
search_delegate_->OnTabDeactivated(contents); if (instant_controller_)
instant_controller_->OnTabDeactivated(contents);
SearchTabHelper::FromWebContents(contents)->OnTabDeactivated(); SearchTabHelper::FromWebContents(contents)->OnTabDeactivated();
// Save what the user's currently typing, so it can be restored when we // Save what the user's currently typing, so it can be restored when we
...@@ -1082,8 +1079,8 @@ void Browser::ActiveTabChanged(WebContents* old_contents, ...@@ -1082,8 +1079,8 @@ void Browser::ActiveTabChanged(WebContents* old_contents,
// Propagate the profile to the location bar. // Propagate the profile to the location bar.
UpdateToolbar((reason & CHANGE_REASON_REPLACED) == 0); UpdateToolbar((reason & CHANGE_REASON_REPLACED) == 0);
if (search::IsInstantExtendedAPIEnabled()) if (instant_controller_)
search_delegate_->OnTabActivated(new_contents); instant_controller_->OnTabActivated(new_contents);
// Update reload/stop state. // Update reload/stop state.
command_controller_->LoadingStateChanged(new_contents->IsLoading(), true); command_controller_->LoadingStateChanged(new_contents->IsLoading(), true);
...@@ -1121,10 +1118,6 @@ void Browser::ActiveTabChanged(WebContents* old_contents, ...@@ -1121,10 +1118,6 @@ void Browser::ActiveTabChanged(WebContents* old_contents,
base::TimeTicks::Now()); base::TimeTicks::Now());
} }
// This needs to be called after notifying SearchDelegate.
if (instant_controller_)
instant_controller_->ActiveTabChanged();
SearchTabHelper::FromWebContents(new_contents)->OnTabActivated(); SearchTabHelper::FromWebContents(new_contents)->OnTabActivated();
} }
...@@ -2392,8 +2385,8 @@ void Browser::TabDetachedAtImpl(content::WebContents* contents, ...@@ -2392,8 +2385,8 @@ void Browser::TabDetachedAtImpl(content::WebContents* contents,
find_bar_controller_->ChangeWebContents(NULL); find_bar_controller_->ChangeWebContents(NULL);
} }
// Stop observing search model changes for this tab. if (instant_controller_)
search_delegate_->OnTabDetached(contents); instant_controller_->OnTabDetached(contents);
for (size_t i = 0; i < interstitial_observers_.size(); i++) { for (size_t i = 0; i < interstitial_observers_.size(); i++) {
if (interstitial_observers_[i]->web_contents() != contents) if (interstitial_observers_[i]->web_contents() != contents)
......
...@@ -70,8 +70,6 @@ class BrowserWindow; ...@@ -70,8 +70,6 @@ class BrowserWindow;
class FindBarController; class FindBarController;
class Profile; class Profile;
class ScopedKeepAlive; class ScopedKeepAlive;
class SearchDelegate;
class SearchModel;
class StatusBubble; class StatusBubble;
class TabStripModel; class TabStripModel;
class TabStripModelDelegate; class TabStripModelDelegate;
...@@ -264,13 +262,6 @@ class Browser : public TabStripModelObserver, ...@@ -264,13 +262,6 @@ class Browser : public TabStripModelObserver,
chrome::BrowserCommandController* command_controller() { chrome::BrowserCommandController* command_controller() {
return command_controller_.get(); return command_controller_.get();
} }
SearchModel* search_model() { return search_model_.get(); }
const SearchModel* search_model() const {
return search_model_.get();
}
SearchDelegate* search_delegate() {
return search_delegate_.get();
}
const SessionID& session_id() const { return session_id_; } const SessionID& session_id() const { return session_id_; }
BrowserContentSettingBubbleModelDelegate* BrowserContentSettingBubbleModelDelegate*
content_setting_bubble_model_delegate() { content_setting_bubble_model_delegate() {
...@@ -918,13 +909,6 @@ class Browser : public TabStripModelObserver, ...@@ -918,13 +909,6 @@ class Browser : public TabStripModelObserver,
// The model for the toolbar view. // The model for the toolbar view.
std::unique_ptr<ToolbarModel> toolbar_model_; std::unique_ptr<ToolbarModel> toolbar_model_;
// The model for the "active" search state. There are per-tab search models
// as well. When a tab is active its model is kept in sync with this one.
// When a new tab is activated its model state is propagated to this active
// model. This way, observers only have to attach to this single model for
// updates, and don't have to worry about active tab changes directly.
std::unique_ptr<SearchModel> search_model_;
// UI update coalescing and handling //////////////////////////////////////// // UI update coalescing and handling ////////////////////////////////////////
typedef std::map<const content::WebContents*, int> UpdateMap; typedef std::map<const content::WebContents*, int> UpdateMap;
...@@ -982,10 +966,6 @@ class Browser : public TabStripModelObserver, ...@@ -982,10 +966,6 @@ class Browser : public TabStripModelObserver,
// Helper which implements the ToolbarModelDelegate interface. // Helper which implements the ToolbarModelDelegate interface.
std::unique_ptr<BrowserToolbarModelDelegate> toolbar_model_delegate_; std::unique_ptr<BrowserToolbarModelDelegate> toolbar_model_delegate_;
// A delegate that handles the details of updating the "active"
// |search_model_| state with the tab's state.
std::unique_ptr<SearchDelegate> search_delegate_;
// Helper which implements the LiveTabContext interface. // Helper which implements the LiveTabContext interface.
std::unique_ptr<BrowserLiveTabContext> live_tab_context_; std::unique_ptr<BrowserLiveTabContext> live_tab_context_;
......
...@@ -78,10 +78,7 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabReloader); ...@@ -78,10 +78,7 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabReloader);
// BrowserInstantController --------------------------------------------------- // BrowserInstantController ---------------------------------------------------
BrowserInstantController::BrowserInstantController(Browser* browser) BrowserInstantController::BrowserInstantController(Browser* browser)
: browser_(browser), : browser_(browser), search_delegate_(&search_model_), instant_(this) {
instant_(this) {
browser_->search_model()->AddObserver(this);
TemplateURLService* template_url_service = TemplateURLService* template_url_service =
TemplateURLServiceFactory::GetForProfile(profile()); TemplateURLServiceFactory::GetForProfile(profile());
// TemplateURLService can be null in tests. // TemplateURLService can be null in tests.
...@@ -95,9 +92,7 @@ BrowserInstantController::BrowserInstantController(Browser* browser) ...@@ -95,9 +92,7 @@ BrowserInstantController::BrowserInstantController(Browser* browser)
} }
} }
BrowserInstantController::~BrowserInstantController() { BrowserInstantController::~BrowserInstantController() = default;
browser_->search_model()->RemoveObserver(this);
}
Profile* BrowserInstantController::profile() const { Profile* BrowserInstantController::profile() const {
return browser_->profile(); return browser_->profile();
...@@ -107,13 +102,21 @@ content::WebContents* BrowserInstantController::GetActiveWebContents() const { ...@@ -107,13 +102,21 @@ content::WebContents* BrowserInstantController::GetActiveWebContents() const {
return browser_->tab_strip_model()->GetActiveWebContents(); return browser_->tab_strip_model()->GetActiveWebContents();
} }
void BrowserInstantController::ActiveTabChanged() { void BrowserInstantController::OnTabActivated(
content::WebContents* web_contents) {
// Note: Order matters, |search_delegate_| must be notified first.
search_delegate_.OnTabActivated(web_contents);
instant_.ActiveTabChanged(); instant_.ActiveTabChanged();
} }
void BrowserInstantController::ModelChanged(SearchModel::Origin old_origin, void BrowserInstantController::OnTabDeactivated(
SearchModel::Origin new_origin) { content::WebContents* web_contents) {
instant_.SearchModeChanged(old_origin, new_origin); search_delegate_.OnTabDeactivated(web_contents);
}
void BrowserInstantController::OnTabDetached(
content::WebContents* web_contents) {
search_delegate_.OnTabDetached(web_contents);
} }
void BrowserInstantController::OnSearchEngineBaseURLChanged( void BrowserInstantController::OnSearchEngineBaseURLChanged(
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/search/search_engine_base_url_tracker.h" #include "chrome/browser/search/search_engine_base_url_tracker.h"
#include "chrome/browser/ui/search/instant_controller.h" #include "chrome/browser/ui/search/instant_controller.h"
#include "chrome/browser/ui/search/search_model_observer.h" #include "chrome/browser/ui/search/search_delegate.h"
#include "chrome/browser/ui/search/search_model.h"
class Browser; class Browser;
class Profile; class Profile;
...@@ -20,32 +21,50 @@ namespace content { ...@@ -20,32 +21,50 @@ namespace content {
class WebContents; class WebContents;
} }
class BrowserInstantController : public SearchModelObserver { // BrowserInstantController is responsible for reloading any Instant tabs (which
// today just means NTPs) when the default search provider changes. This can
// happen when the user chooses a different default search engine, or when the
// Google base URL changes while Google is the default search engine. Also owns
// a SearchModel instance that corresponds to the currently-active tab.
class BrowserInstantController {
public: public:
explicit BrowserInstantController(Browser* browser); explicit BrowserInstantController(Browser* browser);
~BrowserInstantController() override; ~BrowserInstantController();
// Returns the Profile associated with the Browser that owns this object. // Returns the Profile associated with the Browser that owns this object.
Profile* profile() const; Profile* profile() const;
InstantController* instant() { return &instant_; } InstantController* instant() { return &instant_; }
SearchModel* search_model() { return &search_model_; }
// Invoked by |instant_| to get the currently active tab. // Invoked by |instant_| to get the currently active tab.
content::WebContents* GetActiveWebContents() const; content::WebContents* GetActiveWebContents() const;
// Invoked by |browser_| when the active tab changes. // Invoked by |browser_| when the active tab changes.
void ActiveTabChanged(); // TODO(treib): Implement TabStripModelObserver instead of relying on custom
// callbacks from Browser.
void OnTabActivated(content::WebContents* web_contents);
void OnTabDeactivated(content::WebContents* web_contents);
void OnTabDetached(content::WebContents* web_contents);
private: private:
// SearchModelObserver:
void ModelChanged(SearchModel::Origin old_origin,
SearchModel::Origin new_origin) override;
void OnSearchEngineBaseURLChanged( void OnSearchEngineBaseURLChanged(
SearchEngineBaseURLTracker::ChangeReason change_reason); SearchEngineBaseURLTracker::ChangeReason change_reason);
Browser* const browser_; Browser* const browser_;
// The model for the "active" search state. There are per-tab search models
// as well. When a tab is active its model is kept in sync with this one.
// When a new tab is activated its model state is propagated to this active
// model. This way, observers only have to attach to this single model for
// updates, and don't have to worry about active tab changes directly.
SearchModel search_model_;
// A delegate that handles the details of updating the "active"
// |search_model_| state with the tab's state.
SearchDelegate search_delegate_;
InstantController instant_; InstantController instant_;
std::unique_ptr<SearchEngineBaseURLTracker> search_engine_base_url_tracker_; std::unique_ptr<SearchEngineBaseURLTracker> search_engine_base_url_tracker_;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "chrome/browser/search/instant_service.h" #include "chrome/browser/search/instant_service.h"
#include "chrome/browser/search/instant_service_factory.h" #include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/ui/browser_instant_controller.h" #include "chrome/browser/ui/browser_instant_controller.h"
#include "chrome/browser/ui/search/search_tab_helper.h"
#include "content/public/browser/navigation_handle.h" #include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
...@@ -40,17 +41,26 @@ class InstantController::TabObserver : public content::WebContentsObserver { ...@@ -40,17 +41,26 @@ class InstantController::TabObserver : public content::WebContentsObserver {
DISALLOW_COPY_AND_ASSIGN(TabObserver); DISALLOW_COPY_AND_ASSIGN(TabObserver);
}; };
InstantController::InstantController(BrowserInstantController* browser) InstantController::InstantController(
: browser_(browser), search_origin_(SearchModel::Origin::DEFAULT) {} BrowserInstantController* browser_instant_controller)
: browser_instant_controller_(browser_instant_controller) {
browser_instant_controller_->search_model()->AddObserver(this);
}
InstantController::~InstantController() = default; InstantController::~InstantController() {
browser_instant_controller_->search_model()->RemoveObserver(this);
}
void InstantController::SearchModeChanged(SearchModel::Origin old_origin, void InstantController::ModelChanged(SearchModel::Origin old_origin,
SearchModel::Origin new_origin) { SearchModel::Origin new_origin) {
LogDebugEvent(base::StringPrintf("SearchModeChanged: %d to %d", old_origin, // The search mode in the active tab has changed. Bind |instant_tab_observer_|
new_origin)); // if the |new_origin| reflects an Instant NTP.
// Note: This can be called either because the SearchMode changed within the
// current tab, or because the active tab changed. In the latter case, this
// gets called before ActiveTabChanged().
LogDebugEvent(
base::StringPrintf("ModelChanged: %d to %d", old_origin, new_origin));
search_origin_ = new_origin;
ResetInstantTab(); ResetInstantTab();
} }
...@@ -85,8 +95,13 @@ void InstantController::InstantTabAboutToNavigateMainFrame() { ...@@ -85,8 +95,13 @@ void InstantController::InstantTabAboutToNavigateMainFrame() {
} }
void InstantController::ResetInstantTab() { void InstantController::ResetInstantTab() {
if (search_origin_ == SearchModel::Origin::NTP) { content::WebContents* active_tab =
content::WebContents* active_tab = browser_->GetActiveWebContents(); browser_instant_controller_->GetActiveWebContents();
if (active_tab &&
SearchTabHelper::FromWebContents(active_tab)->model()->origin() ==
SearchModel::Origin::NTP) {
// The active tab is an NTP. If we're not already tracking it, do so and
// also update the required info.
if (!instant_tab_observer_ || if (!instant_tab_observer_ ||
active_tab != instant_tab_observer_->web_contents()) { active_tab != instant_tab_observer_->web_contents()) {
instant_tab_observer_ = base::MakeUnique<TabObserver>( instant_tab_observer_ = base::MakeUnique<TabObserver>(
...@@ -96,14 +111,14 @@ void InstantController::ResetInstantTab() { ...@@ -96,14 +111,14 @@ void InstantController::ResetInstantTab() {
UpdateInfoForInstantTab(); UpdateInfoForInstantTab();
} }
} else { } else {
instant_tab_observer_.reset(); instant_tab_observer_ = nullptr;
} }
} }
void InstantController::UpdateInfoForInstantTab() { void InstantController::UpdateInfoForInstantTab() {
DCHECK(instant_tab_observer_); DCHECK(instant_tab_observer_);
InstantService* instant_service = InstantService* instant_service = InstantServiceFactory::GetForProfile(
InstantServiceFactory::GetForProfile(browser_->profile()); browser_instant_controller_->profile());
if (instant_service) { if (instant_service) {
instant_service->UpdateThemeInfo(); instant_service->UpdateThemeInfo();
instant_service->UpdateMostVisitedItemsInfo(); instant_service->UpdateMostVisitedItemsInfo();
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/ui/search/search_model.h" #include "chrome/browser/ui/search/search_model_observer.h"
class BrowserInstantController; class BrowserInstantController;
...@@ -24,15 +24,15 @@ class BrowserInstantController; ...@@ -24,15 +24,15 @@ class BrowserInstantController;
// * an open tab navigates to an NTP. // * an open tab navigates to an NTP.
// //
// InstantController is owned by Browser via BrowserInstantController. // InstantController is owned by Browser via BrowserInstantController.
class InstantController { class InstantController : public SearchModelObserver {
public: public:
explicit InstantController(BrowserInstantController* browser); explicit InstantController(
~InstantController(); BrowserInstantController* browser_instant_controller);
~InstantController() override;
// The search mode in the active tab has changed. Bind |instant_tab_observer_| // SearchModelObserver:
// if the |new_origin| reflects an Instant NTP. void ModelChanged(SearchModel::Origin old_origin,
void SearchModeChanged(SearchModel::Origin old_origin, SearchModel::Origin new_origin) override;
SearchModel::Origin new_origin);
// The user switched tabs. Bind |instant_tab_observer_| if the newly active // The user switched tabs. Bind |instant_tab_observer_| if the newly active
// tab is an Instant NTP. // tab is an Instant NTP.
...@@ -69,14 +69,11 @@ class InstantController { ...@@ -69,14 +69,11 @@ class InstantController {
// Sends theme info and most visited items to the Instant renderer process. // Sends theme info and most visited items to the Instant renderer process.
void UpdateInfoForInstantTab(); void UpdateInfoForInstantTab();
BrowserInstantController* const browser_; BrowserInstantController* const browser_instant_controller_;
// Only non-null if the current tab is an Instant tab, i.e. an NTP. // Only non-null if the current tab is an Instant tab, i.e. an NTP.
std::unique_ptr<TabObserver> instant_tab_observer_; std::unique_ptr<TabObserver> instant_tab_observer_;
// The search model mode for the active tab.
SearchModel::Origin search_origin_;
// List of events and their timestamps, useful in debugging Instant behaviour. // List of events and their timestamps, useful in debugging Instant behaviour.
mutable std::list<std::pair<int64_t, std::string>> debug_events_; mutable std::list<std::pair<int64_t, std::string>> debug_events_;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_instant_controller.h"
#include "chrome/browser/ui/search/search_model.h" #include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/search/search_tab_helper.h" #include "chrome/browser/ui/search/search_tab_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
...@@ -13,8 +14,11 @@ typedef BrowserWithTestWindowTest SearchDelegateTest; ...@@ -13,8 +14,11 @@ typedef BrowserWithTestWindowTest SearchDelegateTest;
// Test the propagation of search "mode" changes from the tab's search model to // Test the propagation of search "mode" changes from the tab's search model to
// the browser's search model. // the browser's search model.
TEST_F(SearchDelegateTest, SearchModel) { TEST_F(SearchDelegateTest, SearchModel) {
const SearchModel& browser_search_model =
*browser()->instant_controller()->search_model();
// Initial state. // Initial state.
EXPECT_EQ(SearchModel::Origin::DEFAULT, browser()->search_model()->origin()); EXPECT_EQ(SearchModel::Origin::DEFAULT, browser_search_model.origin());
// Propagate change from tab's search model to browser's search model. // Propagate change from tab's search model to browser's search model.
AddTab(browser(), GURL("http://foo/0")); AddTab(browser(), GURL("http://foo/0"));
...@@ -22,7 +26,7 @@ TEST_F(SearchDelegateTest, SearchModel) { ...@@ -22,7 +26,7 @@ TEST_F(SearchDelegateTest, SearchModel) {
browser()->tab_strip_model()->GetWebContentsAt(0); browser()->tab_strip_model()->GetWebContentsAt(0);
SearchTabHelper::FromWebContents(first_tab)->model()->SetOrigin( SearchTabHelper::FromWebContents(first_tab)->model()->SetOrigin(
SearchModel::Origin::NTP); SearchModel::Origin::NTP);
EXPECT_EQ(SearchModel::Origin::NTP, browser()->search_model()->origin()); EXPECT_EQ(SearchModel::Origin::NTP, browser_search_model.origin());
// Add second tab (it gets inserted at index 0), make it active, and make sure // Add second tab (it gets inserted at index 0), make it active, and make sure
// its mode changes propagate to the browser's search model. // its mode changes propagate to the browser's search model.
...@@ -31,14 +35,14 @@ TEST_F(SearchDelegateTest, SearchModel) { ...@@ -31,14 +35,14 @@ TEST_F(SearchDelegateTest, SearchModel) {
browser()->tab_strip_model()->GetWebContentsAt(0); browser()->tab_strip_model()->GetWebContentsAt(0);
ASSERT_NE(first_tab, second_tab); ASSERT_NE(first_tab, second_tab);
browser()->tab_strip_model()->ActivateTabAt(0, true); browser()->tab_strip_model()->ActivateTabAt(0, true);
EXPECT_EQ(SearchModel::Origin::DEFAULT, browser()->search_model()->origin()); EXPECT_EQ(SearchModel::Origin::DEFAULT, browser_search_model.origin());
SearchTabHelper::FromWebContents(second_tab) SearchTabHelper::FromWebContents(second_tab)
->model() ->model()
->SetOrigin(SearchModel::Origin::NTP); ->SetOrigin(SearchModel::Origin::NTP);
EXPECT_EQ(SearchModel::Origin::NTP, browser()->search_model()->origin()); EXPECT_EQ(SearchModel::Origin::NTP, browser_search_model.origin());
// The first tab is not active so changes should not propagate. // The first tab is not active so changes should not propagate.
SearchTabHelper::FromWebContents(first_tab)->model()->SetOrigin( SearchTabHelper::FromWebContents(first_tab)->model()->SetOrigin(
SearchModel::Origin::DEFAULT); SearchModel::Origin::DEFAULT);
EXPECT_EQ(SearchModel::Origin::NTP, browser()->search_model()->origin()); EXPECT_EQ(SearchModel::Origin::NTP, browser_search_model.origin());
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment