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

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

Issue 7650: Move more platform-specific stuff from WebContents to the view.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 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 "base/hash_tables.h" 8 #include "base/hash_tables.h"
9 #include "chrome/browser/download/save_package.h" 9 #include "chrome/browser/download/save_package.h"
10 #include "chrome/browser/fav_icon_helper.h" 10 #include "chrome/browser/fav_icon_helper.h"
11 #include "chrome/browser/printing/print_view_manager.h" 11 #include "chrome/browser/printing/print_view_manager.h"
12 #include "chrome/browser/render_view_host_delegate.h" 12 #include "chrome/browser/render_view_host_delegate.h"
13 #include "chrome/browser/render_view_host_manager.h" 13 #include "chrome/browser/render_view_host_manager.h"
14 #include "chrome/browser/shell_dialogs.h" 14 #include "chrome/browser/shell_dialogs.h"
15 #include "chrome/browser/tab_contents.h" 15 #include "chrome/browser/tab_contents.h"
16 #include "chrome/browser/web_app.h" 16 #include "chrome/browser/web_app.h"
17 17
18 class FindInPageController; 18 class FindInPageController;
19 class InterstitialPageDelegate; 19 class InterstitialPageDelegate;
20 class PasswordManager; 20 class PasswordManager;
21 class PluginInstaller; 21 class PluginInstaller;
22 class RenderViewHost; 22 class RenderViewHost;
23 class RenderViewHostFactory; 23 class RenderViewHostFactory;
24 class RenderWidgetHost; 24 class RenderWidgetHost;
25 class SadTabView;
26 class WebContentsView; 25 class WebContentsView;
27 26
28 // WebContents represents the contents of a tab that shows web pages. It embeds 27 // WebContents represents the contents of a tab that shows web pages. It embeds
29 // a RenderViewHost (via RenderViewHostManager) to actually display the page. 28 // a RenderViewHost (via RenderViewHostManager) to actually display the page.
30 class WebContents : public TabContents, 29 class WebContents : public TabContents,
31 public RenderViewHostDelegate, 30 public RenderViewHostDelegate,
32 public RenderViewHostManager::Delegate, 31 public RenderViewHostManager::Delegate,
33 public SelectFileDialog::Listener, 32 public SelectFileDialog::Listener,
34 public NotificationObserver, 33 public NotificationObserver,
35 public WebApp::Observer { 34 public WebApp::Observer {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 int error_code, 260 int error_code,
262 const GURL& url, 261 const GURL& url,
263 bool showing_repost_interstitial); 262 bool showing_repost_interstitial);
264 virtual void UpdateFavIconURL(RenderViewHost* render_view_host, 263 virtual void UpdateFavIconURL(RenderViewHost* render_view_host,
265 int32 page_id, const GURL& icon_url); 264 int32 page_id, const GURL& icon_url);
266 virtual void DidDownloadImage(RenderViewHost* render_view_host, 265 virtual void DidDownloadImage(RenderViewHost* render_view_host,
267 int id, 266 int id,
268 const GURL& image_url, 267 const GURL& image_url,
269 bool errored, 268 bool errored,
270 const SkBitmap& image); 269 const SkBitmap& image);
271 virtual void ShowContextMenu(const ViewHostMsg_ContextMenu_Params& params);
272 virtual void StartDragging(const WebDropData& drop_data);
273 virtual void UpdateDragCursor(bool is_drop_target);
274 virtual void RequestOpenURL(const GURL& url, 270 virtual void RequestOpenURL(const GURL& url,
275 WindowOpenDisposition disposition); 271 WindowOpenDisposition disposition);
276 virtual void DomOperationResponse(const std::string& json_string, 272 virtual void DomOperationResponse(const std::string& json_string,
277 int automation_id); 273 int automation_id);
278 virtual void ProcessExternalHostMessage(const std::string& receiver, 274 virtual void ProcessExternalHostMessage(const std::string& receiver,
279 const std::string& message); 275 const std::string& message);
280 virtual void GoToEntryAtOffset(int offset); 276 virtual void GoToEntryAtOffset(int offset);
281 virtual void GetHistoryListCount(int* back_list_count, 277 virtual void GetHistoryListCount(int* back_list_count,
282 int* forward_list_count); 278 int* forward_list_count);
283 virtual void RunFileChooser(const std::wstring& default_file); 279 virtual void RunFileChooser(const std::wstring& default_file);
284 virtual void RunJavaScriptMessage(const std::wstring& message, 280 virtual void RunJavaScriptMessage(const std::wstring& message,
285 const std::wstring& default_prompt, 281 const std::wstring& default_prompt,
286 const int flags, 282 const int flags,
287 IPC::Message* reply_msg); 283 IPC::Message* reply_msg);
288 virtual void RunBeforeUnloadConfirm(const std::wstring& message, 284 virtual void RunBeforeUnloadConfirm(const std::wstring& message,
289 IPC::Message* reply_msg); 285 IPC::Message* reply_msg);
290 virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, 286 virtual void ShowModalHTMLDialog(const GURL& url, int width, int height,
291 const std::string& json_arguments, 287 const std::string& json_arguments,
292 IPC::Message* reply_msg); 288 IPC::Message* reply_msg);
293 virtual void PasswordFormsSeen(const std::vector<PasswordForm>& forms); 289 virtual void PasswordFormsSeen(const std::vector<PasswordForm>& forms);
294 virtual void TakeFocus(bool reverse);
295 virtual void PageHasOSDD(RenderViewHost* render_view_host, 290 virtual void PageHasOSDD(RenderViewHost* render_view_host,
296 int32 page_id, const GURL& url, bool autodetected); 291 int32 page_id, const GURL& url, bool autodetected);
297 virtual void InspectElementReply(int num_resources); 292 virtual void InspectElementReply(int num_resources);
298 virtual void DidGetPrintedPagesCount(int cookie, int number_pages); 293 virtual void DidGetPrintedPagesCount(int cookie, int number_pages);
299 virtual void DidPrintPage(const ViewHostMsg_DidPrintPage_Params& params); 294 virtual void DidPrintPage(const ViewHostMsg_DidPrintPage_Params& params);
300 virtual GURL GetAlternateErrorPageURL() const; 295 virtual GURL GetAlternateErrorPageURL() const;
301 virtual WebPreferences GetWebkitPrefs(); 296 virtual WebPreferences GetWebkitPrefs();
302 virtual void OnMissingPluginStatus(int status); 297 virtual void OnMissingPluginStatus(int status);
303 virtual void OnCrashedPlugin(const std::wstring& plugin_path); 298 virtual void OnCrashedPlugin(const std::wstring& plugin_path);
304 virtual void OnJSOutOfMemory(); 299 virtual void OnJSOutOfMemory();
(...skipping 10 matching lines...) Expand all
315 } 310 }
316 virtual bool CanBlur() const; 311 virtual bool CanBlur() const;
317 virtual void RendererUnresponsive(RenderViewHost* render_view_host); 312 virtual void RendererUnresponsive(RenderViewHost* render_view_host);
318 virtual void RendererResponsive(RenderViewHost* render_view_host); 313 virtual void RendererResponsive(RenderViewHost* render_view_host);
319 virtual void LoadStateChanged(const GURL& url, net::LoadState load_state); 314 virtual void LoadStateChanged(const GURL& url, net::LoadState load_state);
320 virtual void OnDidGetApplicationInfo( 315 virtual void OnDidGetApplicationInfo(
321 int32 page_id, 316 int32 page_id,
322 const webkit_glue::WebApplicationInfo& info); 317 const webkit_glue::WebApplicationInfo& info);
323 virtual void OnEnterOrSpace(); 318 virtual void OnEnterOrSpace();
324 319
325 // Stupid render view host view pass-throughs.
326 virtual void HandleKeyboardEvent(const WebKeyboardEvent& event);
327
328 // SelectFileDialog::Listener ------------------------------------------------ 320 // SelectFileDialog::Listener ------------------------------------------------
329 321
330 virtual void FileSelected(const std::wstring& path, void* params); 322 virtual void FileSelected(const std::wstring& path, void* params);
331 virtual void FileSelectionCanceled(void* params); 323 virtual void FileSelectionCanceled(void* params);
332 324
333 // RenderViewHostManager::Delegate ------------------------------------------- 325 // RenderViewHostManager::Delegate -------------------------------------------
334 326
335 virtual void BeforeUnloadFiredFromRenderManager( 327 virtual void BeforeUnloadFiredFromRenderManager(
336 bool proceed, 328 bool proceed,
337 bool* proceed_to_fire_unload); 329 bool* proceed_to_fire_unload);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 // instance's page id, the site instances page id is updated as well as the 437 // instance's page id, the site instances page id is updated as well as the
446 // renderers max page id. 438 // renderers max page id.
447 void UpdateMaxPageIDIfNecessary(SiteInstance* site_instance, 439 void UpdateMaxPageIDIfNecessary(SiteInstance* site_instance,
448 RenderViewHost* rvh); 440 RenderViewHost* rvh);
449 441
450 // Called by OnMsgNavigate to update history state. Overridden by subclasses 442 // Called by OnMsgNavigate to update history state. Overridden by subclasses
451 // that don't want to be added to history. 443 // that don't want to be added to history.
452 virtual void UpdateHistoryForNavigation(const GURL& display_url, 444 virtual void UpdateHistoryForNavigation(const GURL& display_url,
453 const ViewHostMsg_FrameNavigate_Params& params); 445 const ViewHostMsg_FrameNavigate_Params& params);
454 446
447 // Saves the given title to the navigation entry and does associated work. It
448 // will update history and the view for the new title, and also synthesize
449 // titles for file URLs that have none (so we require that the URL of the
450 // entry already be set).
451 //
452 // This is used as the backend for state updates, which include a new title,
453 // or the dedicated set title message. It returns true if the new title is
454 // different and was therefore updated.
455 bool UpdateTitleForEntry(NavigationEntry* entry, const std::wstring& title);
456
455 // Misc non-view stuff ------------------------------------------------------- 457 // Misc non-view stuff -------------------------------------------------------
456 458
457 // Helper functions for sending notifications. 459 // Helper functions for sending notifications.
458 void NotifySwapped(); 460 void NotifySwapped();
459 void NotifyConnected(); 461 void NotifyConnected();
460 void NotifyDisconnected(); 462 void NotifyDisconnected();
461 463
462 // If params has a searchable form, this tries to create a new keyword. 464 // If params has a searchable form, this tries to create a new keyword.
463 void GenerateKeywordIfNecessary( 465 void GenerateKeywordIfNecessary(
464 const ViewHostMsg_FrameNavigate_Params& params); 466 const ViewHostMsg_FrameNavigate_Params& params);
(...skipping 23 matching lines...) Expand all
488 GURL last_url_; 490 GURL last_url_;
489 491
490 // Maps from handle to page_id. 492 // Maps from handle to page_id.
491 typedef std::map<HistoryService::Handle, int32> HistoryRequestMap; 493 typedef std::map<HistoryService::Handle, int32> HistoryRequestMap;
492 HistoryRequestMap history_requests_; 494 HistoryRequestMap history_requests_;
493 495
494 // System time at which the current load was started. 496 // System time at which the current load was started.
495 TimeTicks current_load_start_; 497 TimeTicks current_load_start_;
496 498
497 // Whether we have a (non-empty) title for the current page. 499 // Whether we have a (non-empty) title for the current page.
498 // Used to prevent subsequent title updates from affecting history. 500 // Used to prevent subsequent title updates from affecting history. This
499 bool has_page_title_; 501 // prevents some weirdness because some AJAXy apps use titles for status
502 // messages.
503 bool received_page_title_;
500 504
501 // SavePackage, lazily created. 505 // SavePackage, lazily created.
502 scoped_refptr<SavePackage> save_package_; 506 scoped_refptr<SavePackage> save_package_;
503 507
504 // Handles communication with the FindInPage popup. 508 // Handles communication with the FindInPage popup.
505 scoped_ptr<FindInPageController> find_in_page_controller_; 509 scoped_ptr<FindInPageController> find_in_page_controller_;
506 510
507 // Tracks our pending CancelableRequests. This maps pending requests to 511 // Tracks our pending CancelableRequests. This maps pending requests to
508 // page IDs so that we know whether a given callback still applies. The 512 // page IDs so that we know whether a given callback still applies. The
509 // page ID -1 means no page ID was set. 513 // page ID -1 means no page ID was set.
510 CancelableRequestConsumerT<int32, -1> cancelable_consumer_; 514 CancelableRequestConsumerT<int32, -1> cancelable_consumer_;
511 515
512 // Whether the current URL is starred 516 // Whether the current URL is starred
513 bool is_starred_; 517 bool is_starred_;
514 518
515 // Handle to an event that's set when the page is showing a message box (or 519 // Handle to an event that's set when the page is showing a message box (or
516 // equivalent constrained window). Plugin processes check this to know if 520 // equivalent constrained window). Plugin processes check this to know if
517 // they should pump messages then. 521 // they should pump messages then.
518 ScopedHandle message_box_active_; 522 ScopedHandle message_box_active_;
519 523
520 // PasswordManager, lazily created. 524 // PasswordManager, lazily created.
521 scoped_ptr<PasswordManager> password_manager_; 525 scoped_ptr<PasswordManager> password_manager_;
522 526
523 // PluginInstaller, lazily created. 527 // PluginInstaller, lazily created.
524 scoped_ptr<PluginInstaller> plugin_installer_; 528 scoped_ptr<PluginInstaller> plugin_installer_;
525 529
526 // The SadTab renderer.
527 // TODO(brettw) move into WebContentsView*.
528 scoped_ptr<SadTabView> sad_tab_;
529
530 // Handles downloading favicons. 530 // Handles downloading favicons.
531 FavIconHelper fav_icon_helper_; 531 FavIconHelper fav_icon_helper_;
532 532
533 // Dialog box used for choosing files to upload from file form fields. 533 // Dialog box used for choosing files to upload from file form fields.
534 scoped_refptr<SelectFileDialog> select_file_dialog_; 534 scoped_refptr<SelectFileDialog> select_file_dialog_;
535 535
536 // The time that the last javascript message was dismissed. 536 // The time that the last javascript message was dismissed.
537 TimeTicks last_javascript_message_dismissal_; 537 TimeTicks last_javascript_message_dismissal_;
538 538
539 // True if the user has decided to block future javascript messages. This is 539 // True if the user has decided to block future javascript messages. This is
(...skipping 13 matching lines...) Expand all
553 net::LoadState load_state_; 553 net::LoadState load_state_;
554 std::wstring load_state_host_; 554 std::wstring load_state_host_;
555 555
556 // Non-null if we're displaying content for a web app. 556 // Non-null if we're displaying content for a web app.
557 scoped_refptr<WebApp> web_app_; 557 scoped_refptr<WebApp> web_app_;
558 558
559 DISALLOW_COPY_AND_ASSIGN(WebContents); 559 DISALLOW_COPY_AND_ASSIGN(WebContents);
560 }; 560 };
561 561
562 #endif // CHROME_BROWSER_WEB_CONTENTS_H_ 562 #endif // CHROME_BROWSER_WEB_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698