Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / omnibox / omnibox_edit_controller.h
blob27572102a59db3e554c1e13fa36375b1a7e0384a
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_CONTROLLER_H_
8 #include "base/strings/string16.h"
9 #include "content/public/common/page_transition_types.h"
10 #include "ui/base/window_open_disposition.h"
11 #include "url/gurl.h"
13 class CommandUpdater;
14 class InstantController;
15 class ToolbarModel;
17 namespace content {
18 class WebContents;
21 namespace gfx {
22 class Image;
25 // I am in hack-and-slash mode right now.
26 // http://code.google.com/p/chromium/issues/detail?id=6772
28 // Embedders of an AutocompleteEdit widget must implement this class.
29 class OmniboxEditController {
30 public:
31 void OnAutocompleteAccept(const GURL& destination_url,
32 WindowOpenDisposition disposition,
33 content::PageTransition transition);
35 // Updates the controller, and, if |contents| is non-NULL, restores saved
36 // state that the tab holds.
37 virtual void Update(const content::WebContents* contents) = 0;
39 // Called when anything has changed that might affect the layout or contents
40 // of the views around the edit, including the text of the edit and the
41 // status of any keyword- or hint-related state.
42 virtual void OnChanged() = 0;
44 // Called whenever the autocomplete edit gets focused.
45 virtual void OnSetFocus() = 0;
47 // Returns the InstantController, or NULL if instant is not enabled.
48 virtual InstantController* GetInstant() = 0;
50 // Returns the WebContents of the currently active tab.
51 virtual content::WebContents* GetWebContents() = 0;
53 virtual ToolbarModel* GetToolbarModel() = 0;
54 virtual const ToolbarModel* GetToolbarModel() const = 0;
56 protected:
57 explicit OmniboxEditController(CommandUpdater* command_updater);
58 virtual ~OmniboxEditController();
60 CommandUpdater* command_updater() { return command_updater_; }
61 GURL destination_url() const { return destination_url_; }
62 WindowOpenDisposition disposition() const { return disposition_; }
63 content::PageTransition transition() const { return transition_; }
65 private:
66 CommandUpdater* command_updater_;
68 // The details necessary to open the user's desired omnibox match.
69 GURL destination_url_;
70 WindowOpenDisposition disposition_;
71 content::PageTransition transition_;
73 DISALLOW_COPY_AND_ASSIGN(OmniboxEditController);
76 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_CONTROLLER_H_