OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_TAB_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/printing/print_view_manager.h" | 28 #include "chrome/browser/printing/print_view_manager.h" |
29 #include "chrome/browser/shell_dialogs.h" | 29 #include "chrome/browser/shell_dialogs.h" |
30 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 30 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
31 #include "chrome/browser/tab_contents/constrained_window.h" | 31 #include "chrome/browser/tab_contents/constrained_window.h" |
32 #include "chrome/browser/tab_contents/infobar_delegate.h" | 32 #include "chrome/browser/tab_contents/infobar_delegate.h" |
33 #include "chrome/browser/tab_contents/language_state.h" | 33 #include "chrome/browser/tab_contents/language_state.h" |
34 #include "chrome/browser/tab_contents/navigation_controller.h" | 34 #include "chrome/browser/tab_contents/navigation_controller.h" |
35 #include "chrome/browser/tab_contents/navigation_entry.h" | 35 #include "chrome/browser/tab_contents/navigation_entry.h" |
36 #include "chrome/browser/tab_contents/page_navigator.h" | 36 #include "chrome/browser/tab_contents/page_navigator.h" |
37 #include "chrome/browser/tab_contents/render_view_host_manager.h" | 37 #include "chrome/browser/tab_contents/render_view_host_manager.h" |
| 38 #include "chrome/common/content_settings.h" |
38 #include "chrome/common/content_settings_types.h" | 39 #include "chrome/common/content_settings_types.h" |
39 #include "chrome/common/extensions/url_pattern.h" | 40 #include "chrome/common/extensions/url_pattern.h" |
40 #include "chrome/common/navigation_types.h" | 41 #include "chrome/common/navigation_types.h" |
41 #include "chrome/common/notification_registrar.h" | 42 #include "chrome/common/notification_registrar.h" |
42 #include "chrome/common/property_bag.h" | 43 #include "chrome/common/property_bag.h" |
43 #include "chrome/common/renderer_preferences.h" | 44 #include "chrome/common/renderer_preferences.h" |
44 #include "net/base/load_states.h" | 45 #include "net/base/load_states.h" |
45 #include "webkit/glue/dom_operations.h" | 46 #include "webkit/glue/dom_operations.h" |
46 #include "webkit/glue/password_form.h" | 47 #include "webkit/glue/password_form.h" |
47 #include "webkit/glue/webpreferences.h" | 48 #include "webkit/glue/webpreferences.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 bool FavIconIsValid() const; | 234 bool FavIconIsValid() const; |
234 | 235 |
235 // Returns whether the favicon should be displayed. If this returns false, no | 236 // Returns whether the favicon should be displayed. If this returns false, no |
236 // space is provided for the favicon, and the favicon is never displayed. | 237 // space is provided for the favicon, and the favicon is never displayed. |
237 virtual bool ShouldDisplayFavIcon(); | 238 virtual bool ShouldDisplayFavIcon(); |
238 | 239 |
239 // Returns whether a particular kind of content has been blocked for this | 240 // Returns whether a particular kind of content has been blocked for this |
240 // page. | 241 // page. |
241 bool IsContentBlocked(ContentSettingsType content_type) const; | 242 bool IsContentBlocked(ContentSettingsType content_type) const; |
242 | 243 |
| 244 // Returns the current settings for geolocation services in this page. |
| 245 typedef std::map<std::string, ContentSetting> GeolocationContentSettings; |
| 246 const GeolocationContentSettings& geolocation_content_settings() const { |
| 247 return geolocation_content_settings_; |
| 248 } |
| 249 |
243 // Returns a human-readable description the tab's loading state. | 250 // Returns a human-readable description the tab's loading state. |
244 virtual std::wstring GetStatusText() const; | 251 virtual std::wstring GetStatusText() const; |
245 | 252 |
246 // Return whether this tab contents is loading a resource. | 253 // Return whether this tab contents is loading a resource. |
247 bool is_loading() const { return is_loading_; } | 254 bool is_loading() const { return is_loading_; } |
248 | 255 |
249 // Returns whether this tab contents is waiting for a first-response for the | 256 // Returns whether this tab contents is waiting for a first-response for the |
250 // main resource of the page. This controls whether the throbber state is | 257 // main resource of the page. This controls whether the throbber state is |
251 // "waiting" or "loading." | 258 // "waiting" or "loading." |
252 bool waiting_for_response() const { return waiting_for_response_; } | 259 bool waiting_for_response() const { return waiting_for_response_; } |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 | 693 |
687 // So InterstitialPage can access SetIsLoading. | 694 // So InterstitialPage can access SetIsLoading. |
688 friend class InterstitialPage; | 695 friend class InterstitialPage; |
689 | 696 |
690 // TODO(brettw) TestTabContents shouldn't exist! | 697 // TODO(brettw) TestTabContents shouldn't exist! |
691 friend class TestTabContents; | 698 friend class TestTabContents; |
692 | 699 |
693 // Resets the |content_blocked_| array. | 700 // Resets the |content_blocked_| array. |
694 void ClearBlockedContentSettings(); | 701 void ClearBlockedContentSettings(); |
695 | 702 |
| 703 // Resets the |geolocation_settings_| map. |
| 704 void ClearGeolocationContentSettings(); |
| 705 |
696 // Changes the IsLoading state and notifies delegate as needed | 706 // Changes the IsLoading state and notifies delegate as needed |
697 // |details| is used to provide details on the load that just finished | 707 // |details| is used to provide details on the load that just finished |
698 // (but can be null if not applicable). Can be overridden. | 708 // (but can be null if not applicable). Can be overridden. |
699 void SetIsLoading(bool is_loading, | 709 void SetIsLoading(bool is_loading, |
700 LoadNotificationDetails* details); | 710 LoadNotificationDetails* details); |
701 | 711 |
702 // Adds the incoming |new_contents| to the |blocked_popups_| container. | 712 // Adds the incoming |new_contents| to the |blocked_popups_| container. |
703 void AddPopup(TabContents* new_contents, | 713 void AddPopup(TabContents* new_contents, |
704 const gfx::Rect& initial_pos); | 714 const gfx::Rect& initial_pos); |
705 | 715 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 virtual void DidDisplayInsecureContent(); | 839 virtual void DidDisplayInsecureContent(); |
830 virtual void DidRunInsecureContent(const std::string& security_origin); | 840 virtual void DidRunInsecureContent(const std::string& security_origin); |
831 virtual void DidFailProvisionalLoadWithError( | 841 virtual void DidFailProvisionalLoadWithError( |
832 RenderViewHost* render_view_host, | 842 RenderViewHost* render_view_host, |
833 bool is_main_frame, | 843 bool is_main_frame, |
834 int error_code, | 844 int error_code, |
835 const GURL& url, | 845 const GURL& url, |
836 bool showing_repost_interstitial); | 846 bool showing_repost_interstitial); |
837 virtual void DocumentLoadedInFrame(); | 847 virtual void DocumentLoadedInFrame(); |
838 virtual void OnContentBlocked(ContentSettingsType type); | 848 virtual void OnContentBlocked(ContentSettingsType type); |
| 849 virtual void OnGeolocationPermissionSet(const std::string& host, |
| 850 bool allowed); |
839 | 851 |
840 // RenderViewHostDelegate implementation. | 852 // RenderViewHostDelegate implementation. |
841 virtual RenderViewHostDelegate::View* GetViewDelegate(); | 853 virtual RenderViewHostDelegate::View* GetViewDelegate(); |
842 virtual RenderViewHostDelegate::RendererManagement* | 854 virtual RenderViewHostDelegate::RendererManagement* |
843 GetRendererManagementDelegate(); | 855 GetRendererManagementDelegate(); |
844 virtual RenderViewHostDelegate::BrowserIntegration* | 856 virtual RenderViewHostDelegate::BrowserIntegration* |
845 GetBrowserIntegrationDelegate(); | 857 GetBrowserIntegrationDelegate(); |
846 virtual RenderViewHostDelegate::Resource* GetResourceDelegate(); | 858 virtual RenderViewHostDelegate::Resource* GetResourceDelegate(); |
847 virtual RenderViewHostDelegate::Save* GetSaveDelegate(); | 859 virtual RenderViewHostDelegate::Save* GetSaveDelegate(); |
848 virtual RenderViewHostDelegate::Printing* GetPrintingDelegate(); | 860 virtual RenderViewHostDelegate::Printing* GetPrintingDelegate(); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 // profile | 1201 // profile |
1190 scoped_refptr<URLRequestContextGetter> request_context_; | 1202 scoped_refptr<URLRequestContextGetter> request_context_; |
1191 | 1203 |
1192 // If non-null this tab is an app tab and this is the extension the tab was | 1204 // If non-null this tab is an app tab and this is the extension the tab was |
1193 // created for. | 1205 // created for. |
1194 Extension* app_extension_; | 1206 Extension* app_extension_; |
1195 | 1207 |
1196 // Information about the language the page is in and has been translated to. | 1208 // Information about the language the page is in and has been translated to. |
1197 LanguageState language_state_; | 1209 LanguageState language_state_; |
1198 | 1210 |
| 1211 // Maps each frame on this page to its geolocation content settings. |
| 1212 GeolocationContentSettings geolocation_content_settings_; |
| 1213 |
1199 // --------------------------------------------------------------------------- | 1214 // --------------------------------------------------------------------------- |
1200 | 1215 |
1201 DISALLOW_COPY_AND_ASSIGN(TabContents); | 1216 DISALLOW_COPY_AND_ASSIGN(TabContents); |
1202 }; | 1217 }; |
1203 | 1218 |
1204 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 1219 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
OLD | NEW |