OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 virtual WebContentsView* GetView() const OVERRIDE; | 186 virtual WebContentsView* GetView() const OVERRIDE; |
187 virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE; | 187 virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE; |
188 virtual WebUI* GetWebUI() const OVERRIDE; | 188 virtual WebUI* GetWebUI() const OVERRIDE; |
189 virtual WebUI* GetCommittedWebUI() const OVERRIDE; | 189 virtual WebUI* GetCommittedWebUI() const OVERRIDE; |
190 virtual void SetUserAgentOverride(const std::string& override) OVERRIDE; | 190 virtual void SetUserAgentOverride(const std::string& override) OVERRIDE; |
191 virtual const std::string& GetUserAgentOverride() const OVERRIDE; | 191 virtual const std::string& GetUserAgentOverride() const OVERRIDE; |
192 #if defined(OS_WIN) && defined(USE_AURA) | 192 #if defined(OS_WIN) && defined(USE_AURA) |
193 virtual void SetParentNativeViewAccessible( | 193 virtual void SetParentNativeViewAccessible( |
194 gfx::NativeViewAccessible accessible_parent) OVERRIDE; | 194 gfx::NativeViewAccessible accessible_parent) OVERRIDE; |
195 #endif | 195 #endif |
196 virtual const string16& GetTitle() const OVERRIDE; | 196 virtual const base::string16& GetTitle() const OVERRIDE; |
197 virtual int32 GetMaxPageID() OVERRIDE; | 197 virtual int32 GetMaxPageID() OVERRIDE; |
198 virtual int32 GetMaxPageIDForSiteInstance( | 198 virtual int32 GetMaxPageIDForSiteInstance( |
199 SiteInstance* site_instance) OVERRIDE; | 199 SiteInstance* site_instance) OVERRIDE; |
200 virtual SiteInstance* GetSiteInstance() const OVERRIDE; | 200 virtual SiteInstance* GetSiteInstance() const OVERRIDE; |
201 virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE; | 201 virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE; |
202 virtual bool IsLoading() const OVERRIDE; | 202 virtual bool IsLoading() const OVERRIDE; |
203 virtual bool IsWaitingForResponse() const OVERRIDE; | 203 virtual bool IsWaitingForResponse() const OVERRIDE; |
204 virtual const net::LoadStateWithParam& GetLoadState() const OVERRIDE; | 204 virtual const net::LoadStateWithParam& GetLoadState() const OVERRIDE; |
205 virtual const string16& GetLoadStateHost() const OVERRIDE; | 205 virtual const base::string16& GetLoadStateHost() const OVERRIDE; |
206 virtual uint64 GetUploadSize() const OVERRIDE; | 206 virtual uint64 GetUploadSize() const OVERRIDE; |
207 virtual uint64 GetUploadPosition() const OVERRIDE; | 207 virtual uint64 GetUploadPosition() const OVERRIDE; |
208 virtual std::set<GURL> GetSitesInTab() const OVERRIDE; | 208 virtual std::set<GURL> GetSitesInTab() const OVERRIDE; |
209 virtual const std::string& GetEncoding() const OVERRIDE; | 209 virtual const std::string& GetEncoding() const OVERRIDE; |
210 virtual bool DisplayedInsecureContent() const OVERRIDE; | 210 virtual bool DisplayedInsecureContent() const OVERRIDE; |
211 virtual void IncrementCapturerCount() OVERRIDE; | 211 virtual void IncrementCapturerCount() OVERRIDE; |
212 virtual void DecrementCapturerCount() OVERRIDE; | 212 virtual void DecrementCapturerCount() OVERRIDE; |
213 virtual int GetCapturerCount() const OVERRIDE; | 213 virtual int GetCapturerCount() const OVERRIDE; |
214 virtual bool IsCrashed() const OVERRIDE; | 214 virtual bool IsCrashed() const OVERRIDE; |
215 virtual void SetIsCrashed(base::TerminationStatus status, | 215 virtual void SetIsCrashed(base::TerminationStatus status, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 virtual void DidGetRedirectForResourceRequest( | 311 virtual void DidGetRedirectForResourceRequest( |
312 const ResourceRedirectDetails& details) OVERRIDE; | 312 const ResourceRedirectDetails& details) OVERRIDE; |
313 virtual void DidNavigate( | 313 virtual void DidNavigate( |
314 RenderViewHost* render_view_host, | 314 RenderViewHost* render_view_host, |
315 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; | 315 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; |
316 virtual void UpdateState(RenderViewHost* render_view_host, | 316 virtual void UpdateState(RenderViewHost* render_view_host, |
317 int32 page_id, | 317 int32 page_id, |
318 const PageState& page_state) OVERRIDE; | 318 const PageState& page_state) OVERRIDE; |
319 virtual void UpdateTitle(RenderViewHost* render_view_host, | 319 virtual void UpdateTitle(RenderViewHost* render_view_host, |
320 int32 page_id, | 320 int32 page_id, |
321 const string16& title, | 321 const base::string16& title, |
322 base::i18n::TextDirection title_direction) OVERRIDE; | 322 base::i18n::TextDirection title_direction) OVERRIDE; |
323 virtual void UpdateEncoding(RenderViewHost* render_view_host, | 323 virtual void UpdateEncoding(RenderViewHost* render_view_host, |
324 const std::string& encoding) OVERRIDE; | 324 const std::string& encoding) OVERRIDE; |
325 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE; | 325 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE; |
326 virtual void Close(RenderViewHost* render_view_host) OVERRIDE; | 326 virtual void Close(RenderViewHost* render_view_host) OVERRIDE; |
327 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE; | 327 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE; |
328 virtual void SwappedOut(RenderViewHost* render_view_host) OVERRIDE; | 328 virtual void SwappedOut(RenderViewHost* render_view_host) OVERRIDE; |
329 virtual void DidStartLoading(RenderViewHost* render_view_host) OVERRIDE; | 329 virtual void DidStartLoading(RenderViewHost* render_view_host) OVERRIDE; |
330 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; | 330 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; |
331 virtual void DidCancelLoading() OVERRIDE; | 331 virtual void DidCancelLoading() OVERRIDE; |
(...skipping 20 matching lines...) Expand all Loading... |
352 WindowOpenDisposition disposition, | 352 WindowOpenDisposition disposition, |
353 int64 source_frame_id, | 353 int64 source_frame_id, |
354 const GlobalRequestID& transferred_global_request_id, | 354 const GlobalRequestID& transferred_global_request_id, |
355 bool should_replace_current_entry, | 355 bool should_replace_current_entry, |
356 bool user_gesture) OVERRIDE; | 356 bool user_gesture) OVERRIDE; |
357 virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE; | 357 virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE; |
358 virtual void RouteMessageEvent( | 358 virtual void RouteMessageEvent( |
359 RenderViewHost* rvh, | 359 RenderViewHost* rvh, |
360 const ViewMsg_PostMessage_Params& params) OVERRIDE; | 360 const ViewMsg_PostMessage_Params& params) OVERRIDE; |
361 virtual void RunJavaScriptMessage(RenderViewHost* rvh, | 361 virtual void RunJavaScriptMessage(RenderViewHost* rvh, |
362 const string16& message, | 362 const base::string16& message, |
363 const string16& default_prompt, | 363 const base::string16& default_prompt, |
364 const GURL& frame_url, | 364 const GURL& frame_url, |
365 JavaScriptMessageType type, | 365 JavaScriptMessageType type, |
366 IPC::Message* reply_msg, | 366 IPC::Message* reply_msg, |
367 bool* did_suppress_message) OVERRIDE; | 367 bool* did_suppress_message) OVERRIDE; |
368 virtual void RunBeforeUnloadConfirm(RenderViewHost* rvh, | 368 virtual void RunBeforeUnloadConfirm(RenderViewHost* rvh, |
369 const string16& message, | 369 const base::string16& message, |
370 bool is_reload, | 370 bool is_reload, |
371 IPC::Message* reply_msg) OVERRIDE; | 371 IPC::Message* reply_msg) OVERRIDE; |
372 virtual bool AddMessageToConsole(int32 level, | 372 virtual bool AddMessageToConsole(int32 level, |
373 const string16& message, | 373 const base::string16& message, |
374 int32 line_no, | 374 int32 line_no, |
375 const string16& source_id) OVERRIDE; | 375 const base::string16& source_id) OVERRIDE; |
376 virtual RendererPreferences GetRendererPrefs( | 376 virtual RendererPreferences GetRendererPrefs( |
377 BrowserContext* browser_context) const OVERRIDE; | 377 BrowserContext* browser_context) const OVERRIDE; |
378 virtual WebPreferences GetWebkitPrefs() OVERRIDE; | 378 virtual WebPreferences GetWebkitPrefs() OVERRIDE; |
379 virtual void OnUserGesture() OVERRIDE; | 379 virtual void OnUserGesture() OVERRIDE; |
380 virtual void OnIgnoredUIEvent() OVERRIDE; | 380 virtual void OnIgnoredUIEvent() OVERRIDE; |
381 virtual void RendererUnresponsive(RenderViewHost* render_view_host, | 381 virtual void RendererUnresponsive(RenderViewHost* render_view_host, |
382 bool is_during_beforeunload, | 382 bool is_during_beforeunload, |
383 bool is_during_unload) OVERRIDE; | 383 bool is_during_unload) OVERRIDE; |
384 virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE; | 384 virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE; |
385 virtual void LoadStateChanged(const GURL& url, | 385 virtual void LoadStateChanged(const GURL& url, |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 void AddDestructionObserver(WebContentsImpl* web_contents); | 587 void AddDestructionObserver(WebContentsImpl* web_contents); |
588 | 588 |
589 // Deletes and removes from the map a destruction observer | 589 // Deletes and removes from the map a destruction observer |
590 // watching |web_contents|. No-op if there is no such observer. | 590 // watching |web_contents|. No-op if there is no such observer. |
591 void RemoveDestructionObserver(WebContentsImpl* web_contents); | 591 void RemoveDestructionObserver(WebContentsImpl* web_contents); |
592 | 592 |
593 // Callback function when showing JS dialogs. | 593 // Callback function when showing JS dialogs. |
594 void OnDialogClosed(RenderViewHost* rvh, | 594 void OnDialogClosed(RenderViewHost* rvh, |
595 IPC::Message* reply_msg, | 595 IPC::Message* reply_msg, |
596 bool success, | 596 bool success, |
597 const string16& user_input); | 597 const base::string16& user_input); |
598 | 598 |
599 // Callback function when requesting permission to access the PPAPI broker. | 599 // Callback function when requesting permission to access the PPAPI broker. |
600 // |result| is true if permission was granted. | 600 // |result| is true if permission was granted. |
601 void OnPpapiBrokerPermissionResult(int routing_id, bool result); | 601 void OnPpapiBrokerPermissionResult(int routing_id, bool result); |
602 | 602 |
603 // IPC message handlers. | 603 // IPC message handlers. |
604 void OnDidLoadResourceFromMemoryCache(const GURL& url, | 604 void OnDidLoadResourceFromMemoryCache(const GURL& url, |
605 const std::string& security_info, | 605 const std::string& security_info, |
606 const std::string& http_request, | 606 const std::string& http_request, |
607 const std::string& mime_type, | 607 const std::string& mime_type, |
608 ResourceType::Type resource_type); | 608 ResourceType::Type resource_type); |
609 void OnDidDisplayInsecureContent(); | 609 void OnDidDisplayInsecureContent(); |
610 void OnDidRunInsecureContent(const std::string& security_origin, | 610 void OnDidRunInsecureContent(const std::string& security_origin, |
611 const GURL& target_url); | 611 const GURL& target_url); |
612 void OnDocumentLoadedInFrame(int64 frame_id); | 612 void OnDocumentLoadedInFrame(int64 frame_id); |
613 void OnDidFinishLoad(int64 frame_id, | 613 void OnDidFinishLoad(int64 frame_id, |
614 const GURL& url, | 614 const GURL& url, |
615 bool is_main_frame); | 615 bool is_main_frame); |
616 void OnDidFailLoadWithError(int64 frame_id, | 616 void OnDidFailLoadWithError(int64 frame_id, |
617 const GURL& url, | 617 const GURL& url, |
618 bool is_main_frame, | 618 bool is_main_frame, |
619 int error_code, | 619 int error_code, |
620 const string16& error_description); | 620 const base::string16& error_description); |
621 void OnGoToEntryAtOffset(int offset); | 621 void OnGoToEntryAtOffset(int offset); |
622 void OnUpdateZoomLimits(int minimum_percent, | 622 void OnUpdateZoomLimits(int minimum_percent, |
623 int maximum_percent, | 623 int maximum_percent, |
624 bool remember); | 624 bool remember); |
625 void OnEnumerateDirectory(int request_id, const base::FilePath& path); | 625 void OnEnumerateDirectory(int request_id, const base::FilePath& path); |
626 void OnJSOutOfMemory(); | 626 void OnJSOutOfMemory(); |
627 | 627 |
628 void OnRegisterProtocolHandler(const std::string& protocol, | 628 void OnRegisterProtocolHandler(const std::string& protocol, |
629 const GURL& url, | 629 const GURL& url, |
630 const string16& title, | 630 const base::string16& title, |
631 bool user_gesture); | 631 bool user_gesture); |
632 void OnFindReply(int request_id, | 632 void OnFindReply(int request_id, |
633 int number_of_matches, | 633 int number_of_matches, |
634 const gfx::Rect& selection_rect, | 634 const gfx::Rect& selection_rect, |
635 int active_match_ordinal, | 635 int active_match_ordinal, |
636 bool final_update); | 636 bool final_update); |
637 #if defined(OS_ANDROID) | 637 #if defined(OS_ANDROID) |
638 void OnFindMatchRectsReply(int version, | 638 void OnFindMatchRectsReply(int version, |
639 const std::vector<gfx::RectF>& rects, | 639 const std::vector<gfx::RectF>& rects, |
640 const gfx::RectF& active_rect); | 640 const gfx::RectF& active_rect); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 | 707 |
708 // Saves the given title to the navigation entry and does associated work. It | 708 // Saves the given title to the navigation entry and does associated work. It |
709 // will update history and the view for the new title, and also synthesize | 709 // will update history and the view for the new title, and also synthesize |
710 // titles for file URLs that have none (so we require that the URL of the | 710 // titles for file URLs that have none (so we require that the URL of the |
711 // entry already be set). | 711 // entry already be set). |
712 // | 712 // |
713 // This is used as the backend for state updates, which include a new title, | 713 // This is used as the backend for state updates, which include a new title, |
714 // or the dedicated set title message. It returns true if the new title is | 714 // or the dedicated set title message. It returns true if the new title is |
715 // different and was therefore updated. | 715 // different and was therefore updated. |
716 bool UpdateTitleForEntry(NavigationEntryImpl* entry, | 716 bool UpdateTitleForEntry(NavigationEntryImpl* entry, |
717 const string16& title); | 717 const base::string16& title); |
718 | 718 |
719 // Causes the WebContentsImpl to navigate in the right renderer to |entry|, | 719 // Causes the WebContentsImpl to navigate in the right renderer to |entry|, |
720 // which must be already part of the entries in the navigation controller. | 720 // which must be already part of the entries in the navigation controller. |
721 // This does not change the NavigationController state. | 721 // This does not change the NavigationController state. |
722 bool NavigateToEntry(const NavigationEntryImpl& entry, | 722 bool NavigateToEntry(const NavigationEntryImpl& entry, |
723 NavigationController::ReloadType reload_type); | 723 NavigationController::ReloadType reload_type); |
724 | 724 |
725 // Recursively creates swapped out RenderViews for this tab's opener chain | 725 // Recursively creates swapped out RenderViews for this tab's opener chain |
726 // (including this tab) in the given SiteInstance, allowing other tabs to send | 726 // (including this tab) in the given SiteInstance, allowing other tabs to send |
727 // cross-process JavaScript calls to their opener(s). Returns the route ID of | 727 // cross-process JavaScript calls to their opener(s). Returns the route ID of |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific | 869 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific |
870 // to a given tab and SiteInstance, and must be valid for the lifetime of the | 870 // to a given tab and SiteInstance, and must be valid for the lifetime of the |
871 // WebContentsImpl. | 871 // WebContentsImpl. |
872 std::map<int32, int32> max_page_ids_; | 872 std::map<int32, int32> max_page_ids_; |
873 | 873 |
874 // System time at which the current load was started. | 874 // System time at which the current load was started. |
875 base::TimeTicks current_load_start_; | 875 base::TimeTicks current_load_start_; |
876 | 876 |
877 // The current load state and the URL associated with it. | 877 // The current load state and the URL associated with it. |
878 net::LoadStateWithParam load_state_; | 878 net::LoadStateWithParam load_state_; |
879 string16 load_state_host_; | 879 base::string16 load_state_host_; |
880 // Upload progress, for displaying in the status bar. | 880 // Upload progress, for displaying in the status bar. |
881 // Set to zero when there is no significant upload happening. | 881 // Set to zero when there is no significant upload happening. |
882 uint64 upload_size_; | 882 uint64 upload_size_; |
883 uint64 upload_position_; | 883 uint64 upload_position_; |
884 | 884 |
885 // Data for current page ----------------------------------------------------- | 885 // Data for current page ----------------------------------------------------- |
886 | 886 |
887 // When a title cannot be taken from any entry, this title will be used. | 887 // When a title cannot be taken from any entry, this title will be used. |
888 string16 page_title_when_no_navigation_entry_; | 888 base::string16 page_title_when_no_navigation_entry_; |
889 | 889 |
890 // When a navigation occurs, we record its contents MIME type. It can be | 890 // When a navigation occurs, we record its contents MIME type. It can be |
891 // used to check whether we can do something for some special contents. | 891 // used to check whether we can do something for some special contents. |
892 std::string contents_mime_type_; | 892 std::string contents_mime_type_; |
893 | 893 |
894 // Character encoding. | 894 // Character encoding. |
895 std::string encoding_; | 895 std::string encoding_; |
896 | 896 |
897 // True if this is a secure page which displayed insecure content. | 897 // True if this is a secure page which displayed insecure content. |
898 bool displayed_insecure_content_; | 898 bool displayed_insecure_content_; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 // Maps the ids of pending image downloads to their callbacks | 988 // Maps the ids of pending image downloads to their callbacks |
989 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; | 989 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; |
990 ImageDownloadMap image_download_map_; | 990 ImageDownloadMap image_download_map_; |
991 | 991 |
992 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); | 992 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
993 }; | 993 }; |
994 | 994 |
995 } // namespace content | 995 } // namespace content |
996 | 996 |
997 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 997 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |