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

Side by Side Diff: chrome/browser/ui/search/instant_overlay.h

Issue 18223002: InstantExtended: Remove overlay control code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Call renamed method. Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 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.
4
5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_OVERLAY_H_
6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_OVERLAY_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/history/history_types.h"
15 #include "chrome/browser/ui/search/instant_controller.h"
16 #include "chrome/browser/ui/search/instant_loader.h"
17 #include "chrome/browser/ui/search/instant_page.h"
18
19 class Profile;
20
21 namespace content {
22 class WebContents;
23 }
24
25 // InstantOverlay is used to communicate with an overlay WebContents that it
26 // owns and loads the "Instant URL" into. This overlay can appear and disappear
27 // at will as the user types in the omnibox.
28 class InstantOverlay : public InstantPage,
29 public InstantLoader::Delegate {
30 public:
31 // Returns the InstantOverlay for |contents| if it's used for Instant.
32 static InstantOverlay* FromWebContents(const content::WebContents* contents);
33
34 InstantOverlay(InstantController* controller,
35 const std::string& instant_url,
36 bool is_incognito);
37 virtual ~InstantOverlay();
38
39 // Creates a new WebContents and loads |instant_url_| into it. Uses
40 // |active_tab|, if non-NULL, to initialize the size of the WebContents.
41 void InitContents(Profile* profile,
42 const content::WebContents* active_tab);
43
44 // Releases the overlay WebContents. This should be called when the overlay
45 // is committed.
46 scoped_ptr<content::WebContents> ReleaseContents();
47
48 // Returns whether the underlying contents is stale (i.e. was loaded too long
49 // ago).
50 bool is_stale() const { return is_stale_; }
51
52 // Returns true if the mouse or a touch pointer is down due to activating the
53 // overlay contents.
54 bool is_pointer_down_from_activate() const {
55 return is_pointer_down_from_activate_;
56 }
57
58 // Returns info about the last navigation by the Instant page. If the page
59 // hasn't navigated since the last Update(), the URL is empty.
60 const history::HistoryAddPageArgs& last_navigation() const {
61 return last_navigation_;
62 }
63
64 // Called by the history tab helper with information that it would have added
65 // to the history service had this WebContents not been used for Instant.
66 void DidNavigate(const history::HistoryAddPageArgs& add_page_args);
67
68 // Wrapper around InstantIPCSender::Update that also clears
69 // |last_navigation_|.
70 void Update(const string16& text,
71 size_t selection_start,
72 size_t selection_end,
73 bool verbatim);
74
75 private:
76 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantOverlayRefresh);
77 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantOverlayRefreshDifferentOrder);
78
79 // Helper to access delegate() as an InstantController object.
80 InstantController* instant_controller() const {
81 return static_cast<InstantController*>(delegate());
82 }
83
84 // Overriden from InstantLoader::Delegate:
85 virtual void OnSwappedContents() OVERRIDE;
86 virtual void OnFocus() OVERRIDE;
87 virtual void OnMouseDown() OVERRIDE;
88 virtual void OnMouseUp() OVERRIDE;
89 virtual content::WebContents* OpenURLFromTab(
90 content::WebContents* source,
91 const content::OpenURLParams& params) OVERRIDE;
92 virtual void LoadCompletedMainFrame() OVERRIDE;
93
94 // Called when the underlying page becomes stale.
95 void HandleStalePage();
96
97 InstantLoader loader_;
98 bool is_stale_;
99 bool is_pointer_down_from_activate_;
100 history::HistoryAddPageArgs last_navigation_;
101
102 DISALLOW_COPY_AND_ASSIGN(InstantOverlay);
103 };
104
105 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_OVERLAY_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_ipc_sender.cc ('k') | chrome/browser/ui/search/instant_overlay.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698