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

Side by Side Diff: chrome/browser/web_contents.h

Issue 479: DidNavigate refactor of doom (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 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) 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_WEB_CONTENTS_H_ 5 #ifndef CHROME_BROWSER_WEB_CONTENTS_H_
6 #define CHROME_BROWSER_WEB_CONTENTS_H_ 6 #define CHROME_BROWSER_WEB_CONTENTS_H_
7 7
8 #include <hash_map> 8 #include <hash_map>
9 9
10 #include "chrome/browser/fav_icon_helper.h" 10 #include "chrome/browser/fav_icon_helper.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Causes the renderer to invoke the onbeforeunload event handler. The 59 // Causes the renderer to invoke the onbeforeunload event handler. The
60 // result will be returned via ViewMsg_ShouldClose. 60 // result will be returned via ViewMsg_ShouldClose.
61 virtual void FirePageBeforeUnload(); 61 virtual void FirePageBeforeUnload();
62 62
63 // Close the page after the page has responded that it can be closed via 63 // Close the page after the page has responded that it can be closed via
64 // ViewMsg_ShouldClose. This is where the page itself is closed. The 64 // ViewMsg_ShouldClose. This is where the page itself is closed. The
65 // unload handler is triggered here, which can block with a dialog, but cannot 65 // unload handler is triggered here, which can block with a dialog, but cannot
66 // cancel the close of the page. 66 // cancel the close of the page.
67 virtual void FirePageUnload(); 67 virtual void FirePageUnload();
68 68
69
70 // TabContents 69 // TabContents
71 virtual WebContents* AsWebContents() { return this; } 70 virtual WebContents* AsWebContents() { return this; }
72 virtual bool Navigate(const NavigationEntry& entry, bool reload); 71 virtual SiteInstance* GetSiteInstance() const {
72 return render_manager_.current_host()->site_instance();
73 }
74 virtual bool NavigateToPendingEntry(bool reload);
73 virtual void Stop(); 75 virtual void Stop();
74 virtual void DidBecomeSelected(); 76 virtual void DidBecomeSelected();
75 virtual void WasHidden(); 77 virtual void WasHidden();
76 virtual void Destroy(); 78 virtual void Destroy();
77 virtual SkBitmap GetFavIcon(); 79 virtual SkBitmap GetFavIcon();
78 virtual std::wstring GetStatusText() const; 80 virtual std::wstring GetStatusText() const;
79 81
80 // Find functions 82 // Find functions
81 virtual void StartFinding(int request_id, 83 virtual void StartFinding(int request_id,
82 const std::wstring& search_string, 84 const std::wstring& search_string,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // SiteInstance, respectively. Each of these may change over time. Callers 238 // SiteInstance, respectively. Each of these may change over time. Callers
237 // should be aware that the SiteInstance could be deleted if its ref count 239 // should be aware that the SiteInstance could be deleted if its ref count
238 // drops to zero (i.e., if all RenderViewHosts and NavigationEntries that 240 // drops to zero (i.e., if all RenderViewHosts and NavigationEntries that
239 // use it are deleted). 241 // use it are deleted).
240 RenderProcessHost* process() const { 242 RenderProcessHost* process() const {
241 return render_manager_.current_host()->process(); 243 return render_manager_.current_host()->process();
242 } 244 }
243 RenderViewHost* render_view_host() const { 245 RenderViewHost* render_view_host() const {
244 return render_manager_.current_host(); 246 return render_manager_.current_host();
245 } 247 }
246 SiteInstance* site_instance() const {
247 return render_manager_.current_host()->site_instance();
248 }
249 RenderWidgetHostView* view() const { 248 RenderWidgetHostView* view() const {
250 return render_manager_.current_view(); 249 return render_manager_.current_view();
251 } 250 }
252 251
253 // Overridden from TabContents to return the window of the 252 // Overridden from TabContents to return the window of the
254 // RenderWidgetHostView. 253 // RenderWidgetHostView.
255 virtual HWND GetContentHWND(); 254 virtual HWND GetContentHWND();
256 255
257 // Handling the drag and drop of files into the content area. 256 // Handling the drag and drop of files into the content area.
258 virtual bool CanDisplayFile(const std::wstring& full_path); 257 virtual bool CanDisplayFile(const std::wstring& full_path);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 321 }
323 322
324 // Returns true if this WebContents will notify about disconnection. 323 // Returns true if this WebContents will notify about disconnection.
325 bool notify_disconnection() const { return notify_disconnection_; } 324 bool notify_disconnection() const { return notify_disconnection_; }
326 325
327 void set_override_encoding(const std::string& override_encoding) { 326 void set_override_encoding(const std::string& override_encoding) {
328 override_encoding_ = override_encoding; 327 override_encoding_ = override_encoding;
329 } 328 }
330 329
331 protected: 330 protected:
332 FRIEND_TEST(WebContentsTest, OnMessageReceived); 331 FRIEND_TEST(WebContentsTest, UpdateTitle);
333 332
334 // Should be deleted via CloseContents. 333 // Should be deleted via CloseContents.
335 virtual ~WebContents(); 334 virtual ~WebContents();
336 335
337 // RenderViewHostDelegate 336 // RenderViewHostDelegate
338 virtual RenderViewHostDelegate::FindInPage* GetFindInPageDelegate(); 337 virtual RenderViewHostDelegate::FindInPage* GetFindInPageDelegate();
339 virtual Profile* GetProfile() const; 338 virtual Profile* GetProfile() const;
340 339
341 virtual void CreateView(int route_id, HANDLE modal_dialog_event); 340 virtual void CreateView(int route_id, HANDLE modal_dialog_event);
342 virtual void CreateWidget(int route_id); 341 virtual void CreateWidget(int route_id);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 const ViewHostMsg_FrameNavigate_Params& params); 542 const ViewHostMsg_FrameNavigate_Params& params);
544 543
545 // Sets up the View that holds the rendered web page, receives messages for 544 // Sets up the View that holds the rendered web page, receives messages for
546 // it and contains page plugins. 545 // it and contains page plugins.
547 RenderWidgetHostHWND* CreatePageView(RenderViewHost* render_view_host); 546 RenderWidgetHostHWND* CreatePageView(RenderViewHost* render_view_host);
548 547
549 // Navigation helpers -------------------------------------------------------- 548 // Navigation helpers --------------------------------------------------------
550 // 549 //
551 // These functions are helpers for Navigate() and DidNavigate(). 550 // These functions are helpers for Navigate() and DidNavigate().
552 551
553 // Creates a new navigation entry (malloced, the caller will have to free)
554 // for the given committed load. Used by DidNavigate. Will not return NULL.
555 NavigationEntry* CreateNavigationEntryForCommit(
556 const ViewHostMsg_FrameNavigate_Params& params);
557
558 // Handles post-navigation tasks in DidNavigate AFTER the entry has been 552 // Handles post-navigation tasks in DidNavigate AFTER the entry has been
559 // committed to the navigation controller. Note that the navigation entry is 553 // committed to the navigation controller. Note that the navigation entry is
560 // not provided since it may be invalid/changed after being committed. The 554 // not provided since it may be invalid/changed after being committed. The
561 // current navigation entry is in the NavigationController at this point. 555 // current navigation entry is in the NavigationController at this point.
562 void DidNavigateMainFramePostCommit( 556 void DidNavigateMainFramePostCommit(
563 const NavigationController::LoadCommittedDetails& details, 557 const NavigationController::LoadCommittedDetails& details,
564 const ViewHostMsg_FrameNavigate_Params& params); 558 const ViewHostMsg_FrameNavigate_Params& params);
565 void DidNavigateAnyFramePostCommit( 559 void DidNavigateAnyFramePostCommit(
566 RenderViewHost* render_view_host, 560 RenderViewHost* render_view_host,
567 const NavigationController::LoadCommittedDetails& details, 561 const NavigationController::LoadCommittedDetails& details,
568 const ViewHostMsg_FrameNavigate_Params& params); 562 const ViewHostMsg_FrameNavigate_Params& params);
569 563
570 // Called when navigating the main frame to close all child windows if the 564 // Called when navigating the main frame to close all child windows if the
571 // domain is changing. 565 // domain is changing.
572 void MaybeCloseChildWindows(const ViewHostMsg_FrameNavigate_Params& params); 566 void MaybeCloseChildWindows(const ViewHostMsg_FrameNavigate_Params& params);
573 567
574 // Broadcasts a notification for the provisional load committing, used by
575 // DidNavigate.
576 void BroadcastProvisionalLoadCommit(
577 RenderViewHost* render_view_host,
578 const ViewHostMsg_FrameNavigate_Params& params);
579
580 // Convenience method that returns true if navigating to the specified URL
581 // from the current one is an in-page navigation (jumping to a ref in the
582 // page).
583 bool IsInPageNavigation(const GURL& url) const;
584
585 // Updates the starred state from the bookmark bar model. If the state has 568 // Updates the starred state from the bookmark bar model. If the state has
586 // changed, the delegate is notified. 569 // changed, the delegate is notified.
587 void UpdateStarredStateForCurrentURL(); 570 void UpdateStarredStateForCurrentURL();
588 571
589 // Send the alternate error page URL to the renderer. This method is virtual 572 // Send the alternate error page URL to the renderer. This method is virtual
590 // so special html pages can override this (e.g., the new tab page). 573 // so special html pages can override this (e.g., the new tab page).
591 virtual void UpdateAlternateErrorPageURL(); 574 virtual void UpdateAlternateErrorPageURL();
592 575
593 // Send webkit specific settings to the renderer. 576 // Send webkit specific settings to the renderer.
594 void UpdateWebPreferences(); 577 void UpdateWebPreferences();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 scoped_refptr<WebApp> web_app_; 742 scoped_refptr<WebApp> web_app_;
760 743
761 // Specified encoding which is used to override current tab's encoding. 744 // Specified encoding which is used to override current tab's encoding.
762 std::string override_encoding_; 745 std::string override_encoding_;
763 746
764 DISALLOW_COPY_AND_ASSIGN(WebContents); 747 DISALLOW_COPY_AND_ASSIGN(WebContents);
765 }; 748 };
766 749
767 #endif // CHROME_BROWSER_WEB_CONTENTS_H_ 750 #endif // CHROME_BROWSER_WEB_CONTENTS_H_
768 751
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698