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

Side by Side Diff: chrome/browser/tab_contents/interstitial_page.h

Issue 21298: Make accelerators work in interstitial pages (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/tab_contents/interstitial_page.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_
6 #define CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ 6 #define CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gfx/size.h" 10 #include "base/gfx/size.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return WebPreferences(); 85 return WebPreferences();
86 } 86 }
87 virtual void DidNavigate(RenderViewHost* render_view_host, 87 virtual void DidNavigate(RenderViewHost* render_view_host,
88 const ViewHostMsg_FrameNavigate_Params& params); 88 const ViewHostMsg_FrameNavigate_Params& params);
89 virtual void RendererGone(RenderViewHost* render_view_host); 89 virtual void RendererGone(RenderViewHost* render_view_host);
90 virtual void DomOperationResponse(const std::string& json_string, 90 virtual void DomOperationResponse(const std::string& json_string,
91 int automation_id); 91 int automation_id);
92 virtual void UpdateTitle(RenderViewHost* render_view_host, 92 virtual void UpdateTitle(RenderViewHost* render_view_host,
93 int32 page_id, 93 int32 page_id,
94 const std::wstring& title); 94 const std::wstring& title);
95 virtual View* GetViewDelegate() const;
95 96
96 // Invoked when the page sent a command through DOMAutomation. 97 // Invoked when the page sent a command through DOMAutomation.
97 virtual void CommandReceived(const std::string& command) { } 98 virtual void CommandReceived(const std::string& command) { }
98 99
99 // Invoked with the NavigationEntry that is going to be added to the 100 // Invoked with the NavigationEntry that is going to be added to the
100 // navigation controller. 101 // navigation controller.
101 // Gives an opportunity to sub-classes to set states on the |entry|. 102 // Gives an opportunity to sub-classes to set states on the |entry|.
102 // Note that this is only called if the InterstitialPage was constructed with 103 // Note that this is only called if the InterstitialPage was constructed with
103 // |create_navigation_entry| set to true. 104 // |create_navigation_entry| set to true.
104 virtual void UpdateEntry(NavigationEntry* entry) { } 105 virtual void UpdateEntry(NavigationEntry* entry) { }
105 106
106 WebContents* tab() const { return tab_; } 107 WebContents* tab() const { return tab_; }
107 const GURL& url() const { return url_; } 108 const GURL& url() const { return url_; }
108 RenderViewHost* render_view_host() const { return render_view_host_; } 109 RenderViewHost* render_view_host() const { return render_view_host_; }
109 110
110 // Creates and shows the RenderViewHost containing the interstitial content. 111 // Creates and shows the RenderViewHost containing the interstitial content.
111 // Overriden in unit tests. 112 // Overriden in unit tests.
112 virtual RenderViewHost* CreateRenderViewHost(); 113 virtual RenderViewHost* CreateRenderViewHost();
113 114
114 private: 115 private:
115 // AutomationProvider needs access to Proceed and DontProceed to simulate 116 // AutomationProvider needs access to Proceed and DontProceed to simulate
116 // user actions. 117 // user actions.
117 friend class AutomationProvider; 118 friend class AutomationProvider;
118 119
120 class InterstitialPageRVHViewDelegate;
121
119 // Initializes tab_to_interstitial_page_ in a thread-safe manner. 122 // Initializes tab_to_interstitial_page_ in a thread-safe manner.
120 // Should be called before accessing tab_to_interstitial_page_. 123 // Should be called before accessing tab_to_interstitial_page_.
121 static void InitInterstitialPageMap(); 124 static void InitInterstitialPageMap();
122 125
123 // Disable the interstitial: 126 // Disable the interstitial:
124 // - if it is not yet showing, then it won't be shown. 127 // - if it is not yet showing, then it won't be shown.
125 // - any command sent by the RenderViewHost will be ignored. 128 // - any command sent by the RenderViewHost will be ignored.
126 void Disable(); 129 void Disable();
127 130
128 // Executes the passed action on the ResourceDispatcher (on the IO thread). 131 // Executes the passed action on the ResourceDispatcher (on the IO thread).
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 bool should_revert_tab_title_; 164 bool should_revert_tab_title_;
162 165
163 // Whether the ResourceDispatcherHost has been notified to cancel/resume the 166 // Whether the ResourceDispatcherHost has been notified to cancel/resume the
164 // resource requests blocked for the RenderViewHost. 167 // resource requests blocked for the RenderViewHost.
165 bool resource_dispatcher_host_notified_; 168 bool resource_dispatcher_host_notified_;
166 169
167 // The original title of the tab that should be reverted to when the 170 // The original title of the tab that should be reverted to when the
168 // interstitial is hidden. 171 // interstitial is hidden.
169 std::wstring original_tab_title_; 172 std::wstring original_tab_title_;
170 173
174 // Our RenderViewHostViewDelegate, necessary for accelerators to work.
175 scoped_ptr<InterstitialPageRVHViewDelegate> rvh_view_delegate_;
176
171 MessageLoop* ui_loop_; 177 MessageLoop* ui_loop_;
172 178
173 // We keep a map of the various blocking pages shown as the UI tests need to 179 // We keep a map of the various blocking pages shown as the UI tests need to
174 // be able to retrieve them. 180 // be able to retrieve them.
175 typedef std::map<WebContents*,InterstitialPage*> InterstitialPageMap; 181 typedef std::map<WebContents*,InterstitialPage*> InterstitialPageMap;
176 static InterstitialPageMap* tab_to_interstitial_page_; 182 static InterstitialPageMap* tab_to_interstitial_page_;
177 183
178 DISALLOW_COPY_AND_ASSIGN(InterstitialPage); 184 DISALLOW_COPY_AND_ASSIGN(InterstitialPage);
179 }; 185 };
180 186
181 #endif // #ifndef CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ 187 #endif // #ifndef CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_
182 188
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/tab_contents/interstitial_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698