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

Side by Side Diff: content/browser/tab_contents/tab_contents.h

Issue 6794035: Move dispatching and sending of the last extension specific messages out of TabContents and Rende... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <map> 10 #include <map>
(...skipping 12 matching lines...) Expand all
23 #include "chrome/common/instant_types.h" 23 #include "chrome/common/instant_types.h"
24 #include "chrome/common/translate_errors.h" 24 #include "chrome/common/translate_errors.h"
25 #include "chrome/common/web_apps.h" 25 #include "chrome/common/web_apps.h"
26 #include "content/browser/renderer_host/render_view_host_delegate.h" 26 #include "content/browser/renderer_host/render_view_host_delegate.h"
27 #include "content/browser/tab_contents/constrained_window.h" 27 #include "content/browser/tab_contents/constrained_window.h"
28 #include "content/browser/tab_contents/language_state.h" 28 #include "content/browser/tab_contents/language_state.h"
29 #include "content/browser/tab_contents/navigation_controller.h" 29 #include "content/browser/tab_contents/navigation_controller.h"
30 #include "content/browser/tab_contents/navigation_entry.h" 30 #include "content/browser/tab_contents/navigation_entry.h"
31 #include "content/browser/tab_contents/page_navigator.h" 31 #include "content/browser/tab_contents/page_navigator.h"
32 #include "content/browser/tab_contents/render_view_host_manager.h" 32 #include "content/browser/tab_contents/render_view_host_manager.h"
33 #include "content/browser/tab_contents/tab_contents_observer.h"
33 #include "content/browser/webui/web_ui.h" 34 #include "content/browser/webui/web_ui.h"
34 #include "content/common/notification_registrar.h" 35 #include "content/common/notification_registrar.h"
35 #include "content/common/property_bag.h" 36 #include "content/common/property_bag.h"
36 #include "content/common/renderer_preferences.h" 37 #include "content/common/renderer_preferences.h"
37 #include "net/base/load_states.h" 38 #include "net/base/load_states.h"
38 #include "net/base/network_change_notifier.h" 39 #include "net/base/network_change_notifier.h"
39 #include "ui/gfx/native_widget_types.h" 40 #include "ui/gfx/native_widget_types.h"
40 41
41 #if defined(OS_WIN) 42 #if defined(OS_WIN)
42 #include "base/win/scoped_handle.h" 43 #include "base/win/scoped_handle.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // entry. 211 // entry.
211 SkBitmap GetFavicon() const; 212 SkBitmap GetFavicon() const;
212 213
213 // Returns true if we are not using the default favicon. 214 // Returns true if we are not using the default favicon.
214 bool FaviconIsValid() const; 215 bool FaviconIsValid() const;
215 216
216 // Returns whether the favicon should be displayed. If this returns false, no 217 // Returns whether the favicon should be displayed. If this returns false, no
217 // space is provided for the favicon, and the favicon is never displayed. 218 // space is provided for the favicon, and the favicon is never displayed.
218 virtual bool ShouldDisplayFavicon(); 219 virtual bool ShouldDisplayFavicon();
219 220
220 // Add and remove observers for page navigation notifications. Adding or
221 // removing multiple times has no effect. The order in which notifications
222 // are sent to observers is undefined. Clients must be sure to remove the
223 // observer before they go away.
224 void AddObserver(TabContentsObserver* observer);
225 void RemoveObserver(TabContentsObserver* observer);
226
227 // Return whether this tab contents is loading a resource. 221 // Return whether this tab contents is loading a resource.
228 bool is_loading() const { return is_loading_; } 222 bool is_loading() const { return is_loading_; }
229 223
230 // Returns whether this tab contents is waiting for a first-response for the 224 // Returns whether this tab contents is waiting for a first-response for the
231 // main resource of the page. This controls whether the throbber state is 225 // main resource of the page. This controls whether the throbber state is
232 // "waiting" or "loading." 226 // "waiting" or "loading."
233 bool waiting_for_response() const { return waiting_for_response_; } 227 bool waiting_for_response() const { return waiting_for_response_; }
234 228
235 net::LoadState load_state() const { return load_state_; } 229 net::LoadState load_state() const { return load_state_; }
236 string16 load_state_host() const { return load_state_host_; } 230 string16 load_state_host() const { return load_state_host_; }
237 uint64 upload_size() const { return upload_size_; } 231 uint64 upload_size() const { return upload_size_; }
238 uint64 upload_position() const { return upload_position_; } 232 uint64 upload_position() const { return upload_position_; }
239 233
240 const std::string& encoding() const { return encoding_; } 234 const std::string& encoding() const { return encoding_; }
241 void set_encoding(const std::string& encoding); 235 void set_encoding(const std::string& encoding);
242 void reset_encoding() { 236 void reset_encoding() {
243 encoding_.clear(); 237 encoding_.clear();
244 } 238 }
245 239
246 const WebApplicationInfo& web_app_info() const {
247 return web_app_info_;
248 }
249
250 const SkBitmap& app_icon() const { return app_icon_; } 240 const SkBitmap& app_icon() const { return app_icon_; }
251 241
252 // Sets an app icon associated with TabContents and fires an INVALIDATE_TITLE 242 // Sets an app icon associated with TabContents and fires an INVALIDATE_TITLE
253 // navigation state change to trigger repaint of title. 243 // navigation state change to trigger repaint of title.
254 void SetAppIcon(const SkBitmap& app_icon); 244 void SetAppIcon(const SkBitmap& app_icon);
255 245
256 bool displayed_insecure_content() const { 246 bool displayed_insecure_content() const {
257 return displayed_insecure_content_; 247 return displayed_insecure_content_;
258 } 248 }
259 249
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 // the returned ConstrainedWindow might not yet be visible. 359 // the returned ConstrainedWindow might not yet be visible.
370 ConstrainedWindow* CreateConstrainedDialog( 360 ConstrainedWindow* CreateConstrainedDialog(
371 ConstrainedWindowDelegate* delegate); 361 ConstrainedWindowDelegate* delegate);
372 362
373 // Adds a new tab or window with the given already-created contents 363 // Adds a new tab or window with the given already-created contents
374 void AddNewContents(TabContents* new_contents, 364 void AddNewContents(TabContents* new_contents,
375 WindowOpenDisposition disposition, 365 WindowOpenDisposition disposition,
376 const gfx::Rect& initial_pos, 366 const gfx::Rect& initial_pos,
377 bool user_gesture); 367 bool user_gesture);
378 368
379 // Execute code in this tab. Returns true if the message was successfully
380 // sent.
381 bool ExecuteCode(int request_id, const std::string& extension_id,
382 bool is_js_code, const std::string& code_string,
383 bool all_frames);
384
385 // Called when the blocked popup notification is shown or hidden. 369 // Called when the blocked popup notification is shown or hidden.
386 virtual void PopupNotificationVisibilityChanged(bool visible); 370 virtual void PopupNotificationVisibilityChanged(bool visible);
387 371
388 // Returns the number of constrained windows in this tab. Used by tests. 372 // Returns the number of constrained windows in this tab. Used by tests.
389 size_t constrained_window_count() { return child_windows_.size(); } 373 size_t constrained_window_count() { return child_windows_.size(); }
390 374
391 typedef std::deque<ConstrainedWindow*> ConstrainedWindowList; 375 typedef std::deque<ConstrainedWindow*> ConstrainedWindowList;
392 376
393 // Return an iterator for the first constrained window in this tab contents. 377 // Return an iterator for the first constrained window in this tab contents.
394 ConstrainedWindowList::iterator constrained_window_begin() 378 ConstrainedWindowList::iterator constrained_window_begin()
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 void SetContentRestrictions(int restrictions); 640 void SetContentRestrictions(int restrictions);
657 641
658 safe_browsing::ClientSideDetectionHost* safebrowsing_detection_host() { 642 safe_browsing::ClientSideDetectionHost* safebrowsing_detection_host() {
659 return safebrowsing_detection_host_.get(); 643 return safebrowsing_detection_host_.get();
660 } 644 }
661 645
662 // Query the WebUIFactory for the TypeID for the current URL. 646 // Query the WebUIFactory for the TypeID for the current URL.
663 WebUI::TypeID GetWebUITypeForCurrentState(); 647 WebUI::TypeID GetWebUITypeForCurrentState();
664 648
665 protected: 649 protected:
650 friend class TabContentsObserver;
651 friend class TabContentsObserver::Registrar;
652
653 // Add and remove observers for page navigation notifications. Adding or
654 // removing multiple times has no effect. The order in which notifications
655 // are sent to observers is undefined. Clients must be sure to remove the
656 // observer before they go away.
657 void AddObserver(TabContentsObserver* observer);
658 void RemoveObserver(TabContentsObserver* observer);
659
666 // from RenderViewHostDelegate. 660 // from RenderViewHostDelegate.
667 virtual bool OnMessageReceived(const IPC::Message& message); 661 virtual bool OnMessageReceived(const IPC::Message& message);
668 662
669 private: 663 private:
670 friend class NavigationController; 664 friend class NavigationController;
671 // Used to access the child_windows_ (ConstrainedWindowList) for testing 665 // Used to access the child_windows_ (ConstrainedWindowList) for testing
672 // automation purposes. 666 // automation purposes.
673 friend class TestingAutomationProvider; 667 friend class TestingAutomationProvider;
674 668
675 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, NoJSMessageOnInterstitials); 669 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, NoJSMessageOnInterstitials);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 const std::string& security_info); 715 const std::string& security_info);
722 void OnDidDisplayInsecureContent(); 716 void OnDidDisplayInsecureContent();
723 void OnDidRunInsecureContent(const std::string& security_origin, 717 void OnDidRunInsecureContent(const std::string& security_origin,
724 const GURL& target_url); 718 const GURL& target_url);
725 void OnDocumentLoadedInFrame(int64 frame_id); 719 void OnDocumentLoadedInFrame(int64 frame_id);
726 void OnDidFinishLoad(int64 frame_id); 720 void OnDidFinishLoad(int64 frame_id);
727 void OnUpdateContentRestrictions(int restrictions); 721 void OnUpdateContentRestrictions(int restrictions);
728 void OnPDFHasUnsupportedFeature(); 722 void OnPDFHasUnsupportedFeature();
729 723
730 void OnGoToEntryAtOffset(int offset); 724 void OnGoToEntryAtOffset(int offset);
731 void OnDidGetApplicationInfo(int32 page_id, const WebApplicationInfo& info);
732 void OnInstallApplication(const WebApplicationInfo& info);
733 void OnPageContents(const GURL& url, 725 void OnPageContents(const GURL& url,
734 int32 page_id, 726 int32 page_id,
735 const string16& contents, 727 const string16& contents,
736 const std::string& language, 728 const std::string& language,
737 bool page_translatable); 729 bool page_translatable);
738 void OnPageTranslated(int32 page_id, 730 void OnPageTranslated(int32 page_id,
739 const std::string& original_lang, 731 const std::string& original_lang,
740 const std::string& translated_lang, 732 const std::string& translated_lang,
741 TranslateErrors::Type error_type); 733 TranslateErrors::Type error_type);
742 734
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 980
989 // TabContentsSSLHelper, lazily created. 981 // TabContentsSSLHelper, lazily created.
990 scoped_ptr<TabContentsSSLHelper> ssl_helper_; 982 scoped_ptr<TabContentsSSLHelper> ssl_helper_;
991 983
992 // Handles drag and drop event forwarding to extensions. 984 // Handles drag and drop event forwarding to extensions.
993 BookmarkDrag* bookmark_drag_; 985 BookmarkDrag* bookmark_drag_;
994 986
995 // Handles downloading favicons. 987 // Handles downloading favicons.
996 scoped_ptr<FaviconHelper> favicon_helper_; 988 scoped_ptr<FaviconHelper> favicon_helper_;
997 989
998 // Cached web app info data.
999 WebApplicationInfo web_app_info_;
1000
1001 // Cached web app icon. 990 // Cached web app icon.
1002 SkBitmap app_icon_; 991 SkBitmap app_icon_;
1003 992
1004 // RenderViewHost::ContentSettingsDelegate. 993 // RenderViewHost::ContentSettingsDelegate.
1005 scoped_ptr<TabSpecificContentSettings> content_settings_delegate_; 994 scoped_ptr<TabSpecificContentSettings> content_settings_delegate_;
1006 995
1007 // Handles desktop notification IPCs. 996 // Handles desktop notification IPCs.
1008 scoped_ptr<DesktopNotificationHandlerForTC> desktop_notification_handler_; 997 scoped_ptr<DesktopNotificationHandlerForTC> desktop_notification_handler_;
1009 998
1010 // Handles IPCs related to SafeBrowsing client-side phishing detection. 999 // Handles IPCs related to SafeBrowsing client-side phishing detection.
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 ObserverList<TabContentsObserver> observers_; 1136 ObserverList<TabContentsObserver> observers_;
1148 1137
1149 // Content restrictions, used to disable print/copy etc based on content's 1138 // Content restrictions, used to disable print/copy etc based on content's
1150 // (full-page plugins for now only) permissions. 1139 // (full-page plugins for now only) permissions.
1151 int content_restrictions_; 1140 int content_restrictions_;
1152 1141
1153 DISALLOW_COPY_AND_ASSIGN(TabContents); 1142 DISALLOW_COPY_AND_ASSIGN(TabContents);
1154 }; 1143 };
1155 1144
1156 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ 1145 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698