blob: 8d33256cede53bbfd9744c31bddc2523f5467e77 [file] [log] [blame]
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_
#define CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_
#include <memory>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "chrome/browser/search/search_engine_base_url_tracker.h"
#include "chrome/browser/ui/search/instant_controller.h"
#include "chrome/browser/ui/search/search_model_observer.h"
class Browser;
class Profile;
namespace content {
class WebContents;
}
class BrowserInstantController : public SearchModelObserver {
public:
explicit BrowserInstantController(Browser* browser);
~BrowserInstantController() override;
// Returns the Profile associated with the Browser that owns this object.
Profile* profile() const;
InstantController* instant() { return &instant_; }
// Invoked by |instant_| to get the currently active tab.
content::WebContents* GetActiveWebContents() const;
// Invoked by |browser_| when the active tab changes.
void ActiveTabChanged();
private:
// SearchModelObserver:
void ModelChanged(SearchModel::Origin old_origin,
SearchModel::Origin new_origin) override;
void OnSearchEngineBaseURLChanged(
SearchEngineBaseURLTracker::ChangeReason change_reason);
Browser* const browser_;
InstantController instant_;
std::unique_ptr<SearchEngineBaseURLTracker> search_engine_base_url_tracker_;
DISALLOW_COPY_AND_ASSIGN(BrowserInstantController);
};
#endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_