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

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

Issue 6537015: Start moving core pieces of Chrome multi-process code to src\content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 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 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 // TODO(jam): remove this file when all files have been converted.
10 #include <map> 10 #include "content/browser/tab_contents/tab_contents.h"
11 #include <string>
12 #include <vector>
13
14 #include "base/basictypes.h"
15 #include "base/gtest_prod_util.h"
16 #include "base/scoped_ptr.h"
17 #include "base/string16.h"
18 #include "chrome/browser/download/save_package.h"
19 #include "chrome/browser/extensions/image_loading_tracker.h"
20 #include "chrome/browser/fav_icon_helper.h"
21 #include "chrome/browser/prefs/pref_change_registrar.h"
22 #include "chrome/browser/renderer_host/render_view_host_delegate.h"
23 #include "chrome/browser/tab_contents/constrained_window.h"
24 #include "chrome/browser/tab_contents/language_state.h"
25 #include "chrome/browser/tab_contents/navigation_controller.h"
26 #include "chrome/browser/tab_contents/navigation_entry.h"
27 #include "chrome/browser/tab_contents/page_navigator.h"
28 #include "chrome/browser/tab_contents/render_view_host_manager.h"
29 #include "chrome/browser/tab_contents/tab_specific_content_settings.h"
30 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h"
31 #include "chrome/browser/webui/web_ui_factory.h"
32 #include "chrome/common/notification_registrar.h"
33 #include "chrome/common/property_bag.h"
34 #include "chrome/common/renderer_preferences.h"
35 #include "chrome/common/translate_errors.h"
36 #include "chrome/common/web_apps.h"
37 #include "net/base/load_states.h"
38 #include "ui/gfx/native_widget_types.h"
39
40 #if defined(OS_WIN)
41 #include "base/win/scoped_handle.h"
42 #endif
43
44 namespace gfx {
45 class Rect;
46 }
47
48 namespace history {
49 class HistoryAddPageArgs;
50 }
51
52 namespace prerender {
53 class PrerenderManager;
54 class PrerenderPLTRecorder;
55 }
56
57 namespace printing {
58 class PrintPreviewMessageHandler;
59 class PrintViewManager;
60 }
61
62 namespace safe_browsing {
63 class ClientSideDetectionHost;
64 }
65
66 class AutocompleteHistoryManager;
67 class AutoFillManager;
68 class BlockedContentContainer;
69 class WebUI;
70 class DesktopNotificationHandlerForTC;
71 class DownloadItem;
72 class Extension;
73 class FileSelectHelper;
74 class InfoBarDelegate;
75 class LoadNotificationDetails;
76 class OmniboxSearchHint;
77 class PluginObserver;
78 class Profile;
79 class RenderViewHost;
80 class SessionStorageNamespace;
81 class SiteInstance;
82 class SkBitmap;
83 class TabContents;
84 class TabContentsDelegate;
85 class TabContentsObserver;
86 class TabContentsSSLHelper;
87 class TabContentsView;
88 class URLPattern;
89 struct RendererPreferences;
90 struct ThumbnailScore;
91 struct ViewHostMsg_DomMessage_Params;
92 struct ViewHostMsg_FrameNavigate_Params;
93 struct ViewHostMsg_RunFileChooser_Params;
94 struct WebPreferences;
95
96 // Describes what goes in the main content area of a tab. TabContents is
97 // the only type of TabContents, and these should be merged together.
98 class TabContents : public PageNavigator,
99 public NotificationObserver,
100 public RenderViewHostDelegate,
101 public RenderViewHostManager::Delegate,
102 public JavaScriptAppModalDialogDelegate,
103 public ImageLoadingTracker::Observer,
104 public TabSpecificContentSettings::Delegate {
105 public:
106 // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it
107 // what has changed. Combine them to update more than one thing.
108 enum InvalidateTypes {
109 INVALIDATE_URL = 1 << 0, // The URL has changed.
110 INVALIDATE_TAB = 1 << 1, // The favicon, app icon, or crashed
111 // state changed.
112 INVALIDATE_LOAD = 1 << 2, // The loading state has changed.
113 INVALIDATE_PAGE_ACTIONS = 1 << 3, // Page action icons have changed.
114 INVALIDATE_BOOKMARK_BAR = 1 << 4, // State of ShouldShowBookmarkBar
115 // changed.
116 INVALIDATE_TITLE = 1 << 5, // The title changed.
117 };
118
119 // |base_tab_contents| is used if we want to size the new tab contents view
120 // based on an existing tab contents view. This can be NULL if not needed.
121 //
122 // The session storage namespace parameter allows multiple render views and
123 // tab contentses to share the same session storage (part of the WebStorage
124 // spec) space. This is useful when restoring tabs, but most callers should
125 // pass in NULL which will cause a new SessionStorageNamespace to be created.
126 TabContents(Profile* profile,
127 SiteInstance* site_instance,
128 int routing_id,
129 const TabContents* base_tab_contents,
130 SessionStorageNamespace* session_storage_namespace);
131 virtual ~TabContents();
132
133 static void RegisterUserPrefs(PrefService* prefs);
134
135 // Intrinsic tab state -------------------------------------------------------
136
137 // Returns the property bag for this tab contents, where callers can add
138 // extra data they may wish to associate with the tab. Returns a pointer
139 // rather than a reference since the PropertyAccessors expect this.
140 const PropertyBag* property_bag() const { return &property_bag_; }
141 PropertyBag* property_bag() { return &property_bag_; }
142
143 TabContentsDelegate* delegate() const { return delegate_; }
144 void set_delegate(TabContentsDelegate* d) { delegate_ = d; }
145
146 // Gets the controller for this tab contents.
147 NavigationController& controller() { return controller_; }
148 const NavigationController& controller() const { return controller_; }
149
150 // Returns the user profile associated with this TabContents (via the
151 // NavigationController).
152 Profile* profile() const { return controller_.profile(); }
153
154 // Returns true if contains content rendered by an extension.
155 bool HostsExtension() const;
156
157 // Returns the TabContentsSSLHelper, creating it if necessary.
158 TabContentsSSLHelper* GetSSLHelper();
159
160 // Returns the SavePackage which manages the page saving job. May be NULL.
161 SavePackage* save_package() const { return save_package_.get(); }
162
163 // Return the currently active RenderProcessHost and RenderViewHost. Each of
164 // these may change over time.
165 RenderProcessHost* GetRenderProcessHost() const;
166 RenderViewHost* render_view_host() const {
167 return render_manager_.current_host();
168 }
169
170 WebUI* web_ui() const {
171 return render_manager_.web_ui() ? render_manager_.web_ui()
172 : render_manager_.pending_web_ui();
173 }
174
175 // Returns the currently active RenderWidgetHostView. This may change over
176 // time and can be NULL (during setup and teardown).
177 RenderWidgetHostView* GetRenderWidgetHostView() const {
178 return render_manager_.GetRenderWidgetHostView();
179 }
180
181 // The TabContentsView will never change and is guaranteed non-NULL.
182 TabContentsView* view() const {
183 return view_.get();
184 }
185
186 // Returns the FavIconHelper of this TabContents.
187 FavIconHelper& fav_icon_helper() {
188 return *fav_icon_helper_.get();
189 }
190
191 // App extensions ------------------------------------------------------------
192
193 // Sets the extension denoting this as an app. If |extension| is non-null this
194 // tab becomes an app-tab. TabContents does not listen for unload events for
195 // the extension. It's up to consumers of TabContents to do that.
196 //
197 // NOTE: this should only be manipulated before the tab is added to a browser.
198 // TODO(sky): resolve if this is the right way to identify an app tab. If it
199 // is, than this should be passed in the constructor.
200 void SetExtensionApp(const Extension* extension);
201
202 // Convenience for setting the app extension by id. This does nothing if
203 // |extension_app_id| is empty, or an extension can't be found given the
204 // specified id.
205 void SetExtensionAppById(const std::string& extension_app_id);
206
207 const Extension* extension_app() const { return extension_app_; }
208 bool is_app() const { return extension_app_ != NULL; }
209
210 // If an app extension has been explicitly set for this TabContents its icon
211 // is returned.
212 //
213 // NOTE: the returned icon is larger than 16x16 (its size is
214 // Extension::EXTENSION_ICON_SMALLISH).
215 SkBitmap* GetExtensionAppIcon();
216
217 // Tab navigation state ------------------------------------------------------
218
219 // Returns the current navigation properties, which if a navigation is
220 // pending may be provisional (e.g., the navigation could result in a
221 // download, in which case the URL would revert to what it was previously).
222 virtual const GURL& GetURL() const;
223 virtual const string16& GetTitle() const;
224
225 // Initial title assigned to NavigationEntries from Navigate.
226 static string16 GetDefaultTitle();
227
228 // The max PageID of any page that this TabContents has loaded. PageIDs
229 // increase with each new page that is loaded by a tab. If this is a
230 // TabContents, then the max PageID is kept separately on each SiteInstance.
231 // Returns -1 if no PageIDs have yet been seen.
232 int32 GetMaxPageID();
233
234 // Updates the max PageID to be at least the given PageID.
235 void UpdateMaxPageID(int32 page_id);
236
237 // Returns the site instance associated with the current page. By default,
238 // there is no site instance. TabContents overrides this to provide proper
239 // access to its site instance.
240 virtual SiteInstance* GetSiteInstance() const;
241
242 // Defines whether this tab's URL should be displayed in the browser's URL
243 // bar. Normally this is true so you can see the URL. This is set to false
244 // for the new tab page and related pages so that the URL bar is empty and
245 // the user is invited to type into it.
246 virtual bool ShouldDisplayURL();
247
248 // Returns the favicon for this tab, or an isNull() bitmap if the tab does not
249 // have a favicon. The default implementation uses the current navigation
250 // entry.
251 SkBitmap GetFavIcon() const;
252
253 // Returns true if we are not using the default favicon.
254 bool FavIconIsValid() const;
255
256 // Returns whether the favicon should be displayed. If this returns false, no
257 // space is provided for the favicon, and the favicon is never displayed.
258 virtual bool ShouldDisplayFavIcon();
259
260 // Returns a human-readable description the tab's loading state.
261 virtual string16 GetStatusText() const;
262
263 // Add and remove observers for page navigation notifications. Adding or
264 // removing multiple times has no effect. The order in which notifications
265 // are sent to observers is undefined. Clients must be sure to remove the
266 // observer before they go away.
267 void AddObserver(TabContentsObserver* observer);
268 void RemoveObserver(TabContentsObserver* observer);
269
270 // Return whether this tab contents is loading a resource.
271 bool is_loading() const { return is_loading_; }
272
273 // Returns whether this tab contents is waiting for a first-response for the
274 // main resource of the page. This controls whether the throbber state is
275 // "waiting" or "loading."
276 bool waiting_for_response() const { return waiting_for_response_; }
277
278 const std::string& encoding() const { return encoding_; }
279 void set_encoding(const std::string& encoding);
280 void reset_encoding() {
281 encoding_.clear();
282 }
283
284 const WebApplicationInfo& web_app_info() const {
285 return web_app_info_;
286 }
287
288 const SkBitmap& app_icon() const { return app_icon_; }
289
290 // Sets an app icon associated with TabContents and fires an INVALIDATE_TITLE
291 // navigation state change to trigger repaint of title.
292 void SetAppIcon(const SkBitmap& app_icon);
293
294 bool displayed_insecure_content() const {
295 return displayed_insecure_content_;
296 }
297
298 // Internal state ------------------------------------------------------------
299
300 // This flag indicates whether the tab contents is currently being
301 // screenshotted by the DraggedTabController.
302 bool capturing_contents() const { return capturing_contents_; }
303 void set_capturing_contents(bool cap) { capturing_contents_ = cap; }
304
305 // Indicates whether this tab should be considered crashed. The setter will
306 // also notify the delegate when the flag is changed.
307 bool is_crashed() const {
308 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED ||
309 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION ||
310 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED);
311 }
312 base::TerminationStatus crashed_status() const { return crashed_status_; }
313 int crashed_error_code() const { return crashed_error_code_; }
314 void SetIsCrashed(base::TerminationStatus status, int error_code);
315
316 // Call this after updating a page action to notify clients about the changes.
317 void PageActionStateChanged();
318
319 // Whether the tab is in the process of being destroyed.
320 // Added as a tentative work-around for focus related bug #4633. This allows
321 // us not to store focus when a tab is being closed.
322 bool is_being_destroyed() const { return is_being_destroyed_; }
323
324 // Convenience method for notifying the delegate of a navigation state
325 // change. See TabContentsDelegate.
326 void NotifyNavigationStateChanged(unsigned changed_flags);
327
328 // Invoked when the tab contents becomes selected. If you override, be sure
329 // and invoke super's implementation.
330 virtual void DidBecomeSelected();
331 base::TimeTicks last_selected_time() const {
332 return last_selected_time_;
333 }
334
335 // Invoked when the tab contents becomes hidden.
336 // NOTE: If you override this, call the superclass version too!
337 virtual void WasHidden();
338
339 // Activates this contents within its containing window, bringing that window
340 // to the foreground if necessary.
341 void Activate();
342
343 // Deactivates this contents by deactivating its containing window.
344 void Deactivate();
345
346 // TODO(brettw) document these.
347 virtual void ShowContents();
348 virtual void HideContents();
349
350 // Returns true if the before unload and unload listeners need to be
351 // fired. The value of this changes over time. For example, if true and the
352 // before unload listener is executed and allows the user to exit, then this
353 // returns false.
354 bool NeedToFireBeforeUnload();
355
356 #ifdef UNIT_TEST
357 // Expose the render manager for testing.
358 RenderViewHostManager* render_manager() { return &render_manager_; }
359 #endif
360
361 // In the underlying RenderViewHostManager, swaps in the provided
362 // RenderViewHost to replace the current RenderViewHost. The current RVH
363 // will be shutdown and ultimately deleted.
364 void SwapInRenderViewHost(RenderViewHost* rvh);
365
366 // Commands ------------------------------------------------------------------
367
368 // Implementation of PageNavigator.
369 virtual void OpenURL(const GURL& url, const GURL& referrer,
370 WindowOpenDisposition disposition,
371 PageTransition::Type transition);
372
373 // Called by the NavigationController to cause the TabContents to navigate to
374 // the current pending entry. The NavigationController should be called back
375 // with CommitPendingEntry/RendererDidNavigate on success or
376 // DiscardPendingEntry. The callbacks can be inside of this function, or at
377 // some future time.
378 //
379 // The entry has a PageID of -1 if newly created (corresponding to navigation
380 // to a new URL).
381 //
382 // If this method returns false, then the navigation is discarded (equivalent
383 // to calling DiscardPendingEntry on the NavigationController).
384 virtual bool NavigateToPendingEntry(
385 NavigationController::ReloadType reload_type);
386
387 // Stop any pending navigation.
388 virtual void Stop();
389
390 // Called on a TabContents when it isn't a popup, but a new window.
391 virtual void DisassociateFromPopupCount();
392
393 // Creates a new TabContents with the same state as this one. The returned
394 // heap-allocated pointer is owned by the caller.
395 virtual TabContents* Clone();
396
397 // Shows the page info.
398 void ShowPageInfo(const GURL& url,
399 const NavigationEntry::SSLStatus& ssl,
400 bool show_history);
401
402 // Saves the favicon for the current page.
403 void SaveFavicon();
404
405 // Window management ---------------------------------------------------------
406
407 // Create a new window constrained to this TabContents' clip and visibility.
408 // The window is initialized by using the supplied delegate to obtain basic
409 // window characteristics, and the supplied view for the content. Note that
410 // the returned ConstrainedWindow might not yet be visible.
411 ConstrainedWindow* CreateConstrainedDialog(
412 ConstrainedWindowDelegate* delegate);
413
414 // Adds a new tab or window with the given already-created contents
415 void AddNewContents(TabContents* new_contents,
416 WindowOpenDisposition disposition,
417 const gfx::Rect& initial_pos,
418 bool user_gesture);
419
420 // Execute code in this tab. Returns true if the message was successfully
421 // sent.
422 bool ExecuteCode(int request_id, const std::string& extension_id,
423 bool is_js_code, const std::string& code_string,
424 bool all_frames);
425
426 // Called when the blocked popup notification is shown or hidden.
427 virtual void PopupNotificationVisibilityChanged(bool visible);
428
429 // Returns the number of constrained windows in this tab. Used by tests.
430 size_t constrained_window_count() { return child_windows_.size(); }
431
432 typedef std::deque<ConstrainedWindow*> ConstrainedWindowList;
433
434 // Return an iterator for the first constrained window in this tab contents.
435 ConstrainedWindowList::iterator constrained_window_begin()
436 { return child_windows_.begin(); }
437
438 // Return an iterator for the last constrained window in this tab contents.
439 ConstrainedWindowList::iterator constrained_window_end()
440 { return child_windows_.end(); }
441
442 // Views and focus -----------------------------------------------------------
443 // TODO(brettw): Most of these should be removed and the caller should call
444 // the view directly.
445
446 // Returns the actual window that is focused when this TabContents is shown.
447 gfx::NativeView GetContentNativeView() const;
448
449 // Returns the NativeView associated with this TabContents. Outside of
450 // automation in the context of the UI, this is required to be implemented.
451 gfx::NativeView GetNativeView() const;
452
453 // Returns the bounds of this TabContents in the screen coordinate system.
454 void GetContainerBounds(gfx::Rect *out) const;
455
456 // Makes the tab the focused window.
457 void Focus();
458
459 // Focuses the first (last if |reverse| is true) element in the page.
460 // Invoked when this tab is getting the focus through tab traversal (|reverse|
461 // is true when using Shift-Tab).
462 void FocusThroughTabTraversal(bool reverse);
463
464 // These next two functions are declared on RenderViewHostManager::Delegate
465 // but also accessed directly by other callers.
466
467 // Returns true if the location bar should be focused by default rather than
468 // the page contents. The view calls this function when the tab is focused
469 // to see what it should do.
470 virtual bool FocusLocationBarByDefault();
471
472 // Focuses the location bar.
473 virtual void SetFocusToLocationBar(bool select_all);
474
475 // Creates a view and sets the size for the specified RVH.
476 virtual void CreateViewAndSetSizeForRVH(RenderViewHost* rvh);
477
478 // Infobars ------------------------------------------------------------------
479
480 // Adds an InfoBar for the specified |delegate|.
481 virtual void AddInfoBar(InfoBarDelegate* delegate);
482
483 // Removes the InfoBar for the specified |delegate|.
484 void RemoveInfoBar(InfoBarDelegate* delegate);
485
486 // Replaces one infobar with another, without any animation in between.
487 void ReplaceInfoBar(InfoBarDelegate* old_delegate,
488 InfoBarDelegate* new_delegate);
489
490 // Enumeration and access functions.
491 size_t infobar_count() const { return infobar_delegates_.size(); }
492 // WARNING: This does not sanity-check |index|!
493 InfoBarDelegate* GetInfoBarDelegateAt(size_t index) {
494 return infobar_delegates_[index];
495 }
496
497 // Toolbars and such ---------------------------------------------------------
498
499 // Returns true if a Bookmark Bar should be shown for this tab.
500 virtual bool ShouldShowBookmarkBar();
501
502 // Notifies the delegate that a download is about to be started.
503 // This notification is fired before a local temporary file has been created.
504 bool CanDownload(int request_id);
505
506 // Notifies the delegate that a download started.
507 void OnStartDownload(DownloadItem* download);
508
509 // Notify our delegate that some of our content has animated.
510 void ToolbarSizeChanged(bool is_animating);
511
512 // Called when a ConstrainedWindow we own is about to be closed.
513 void WillClose(ConstrainedWindow* window);
514
515 // Called when a BlockedContentContainer we own is about to be closed.
516 void WillCloseBlockedContentContainer(BlockedContentContainer* container);
517
518 // Called when a ConstrainedWindow we own is moved or resized.
519 void DidMoveOrResize(ConstrainedWindow* window);
520
521 // Interstitials -------------------------------------------------------------
522
523 // Various other systems need to know about our interstitials.
524 bool showing_interstitial_page() const {
525 return render_manager_.interstitial_page() != NULL;
526 }
527
528 // Sets the passed passed interstitial as the currently showing interstitial.
529 // |interstitial_page| should be non NULL (use the remove_interstitial_page
530 // method to unset the interstitial) and no interstitial page should be set
531 // when there is already a non NULL interstitial page set.
532 void set_interstitial_page(InterstitialPage* interstitial_page) {
533 render_manager_.set_interstitial_page(interstitial_page);
534 }
535
536 // Unsets the currently showing interstitial.
537 void remove_interstitial_page() {
538 render_manager_.remove_interstitial_page();
539 }
540
541 // Returns the currently showing interstitial, NULL if no interstitial is
542 // showing.
543 InterstitialPage* interstitial_page() const {
544 return render_manager_.interstitial_page();
545 }
546
547 // Misc state & callbacks ----------------------------------------------------
548
549 // Set whether the contents should block javascript message boxes or not.
550 // Default is not to block any message boxes.
551 void set_suppress_javascript_messages(bool suppress_javascript_messages) {
552 suppress_javascript_messages_ = suppress_javascript_messages;
553 }
554
555 // Prepare for saving the current web page to disk.
556 void OnSavePage();
557
558 // Save page with the main HTML file path, the directory for saving resources,
559 // and the save type: HTML only or complete web page. Returns true if the
560 // saving process has been initiated successfully.
561 bool SavePage(const FilePath& main_file, const FilePath& dir_path,
562 SavePackage::SavePackageType save_type);
563
564 // Tells the user's email client to open a compose window containing the
565 // current page's URL.
566 void EmailPageLocation();
567
568 // Displays asynchronously a print preview (generated by the renderer) if not
569 // already displayed and ask the user for its preferred print settings with
570 // the "Print..." dialog box. (managed by the print worker thread).
571 // TODO(maruel): Creates a snapshot of the renderer to be used for the new
572 // tab for the printing facility.
573 void PrintPreview();
574
575 // Prints the current document immediately. Since the rendering is
576 // asynchronous, the actual printing will not be completed on the return of
577 // this function. Returns false if printing is impossible at the moment.
578 bool PrintNow();
579
580 // Notify the completion of a printing job.
581 void PrintingDone(int document_cookie, bool success);
582
583 // Returns true if the active NavigationEntry's page_id equals page_id.
584 bool IsActiveEntry(int32 page_id);
585
586 const std::string& contents_mime_type() const {
587 return contents_mime_type_;
588 }
589
590 // Returns true if this TabContents will notify about disconnection.
591 bool notify_disconnection() const { return notify_disconnection_; }
592
593 // Override the encoding and reload the page by sending down
594 // ViewMsg_SetPageEncoding to the renderer. |UpdateEncoding| is kinda
595 // the opposite of this, by which 'browser' is notified of
596 // the encoding of the current tab from 'renderer' (determined by
597 // auto-detect, http header, meta, bom detection, etc).
598 void SetOverrideEncoding(const std::string& encoding);
599
600 // Remove any user-defined override encoding and reload by sending down
601 // ViewMsg_ResetPageEncodingToDefault to the renderer.
602 void ResetOverrideEncoding();
603
604 void WindowMoveOrResizeStarted();
605
606 // Sets whether all TabContents added by way of |AddNewContents| should be
607 // blocked. Transitioning from all blocked to not all blocked results in
608 // reevaluating any blocked TabContents, which may result in unblocking some
609 // of the blocked TabContents.
610 void SetAllContentsBlocked(bool value);
611
612 BlockedContentContainer* blocked_content_container() const {
613 return blocked_contents_;
614 }
615
616 RendererPreferences* GetMutableRendererPrefs() {
617 return &renderer_preferences_;
618 }
619
620 void set_opener_web_ui_type(WebUITypeID opener_web_ui_type) {
621 opener_web_ui_type_ = opener_web_ui_type;
622 }
623
624 // We want to time how long it takes to create a new tab page. This method
625 // gets called as parts of the new tab page have loaded.
626 void LogNewTabTime(const std::string& event_name);
627
628 // Set the time when we started to create the new tab page. This time is
629 // from before we created this TabContents.
630 void set_new_tab_start_time(const base::TimeTicks& time) {
631 new_tab_start_time_ = time;
632 }
633
634 // Notification that tab closing has started. This can be called multiple
635 // times, subsequent calls are ignored.
636 void OnCloseStarted();
637
638 LanguageState& language_state() {
639 return language_state_;
640 }
641
642 // Returns true if underlying TabContentsView should accept drag-n-drop.
643 bool ShouldAcceptDragAndDrop() const;
644
645 // A render view-originated drag has ended. Informs the render view host and
646 // tab contents delegate.
647 void SystemDragEnded();
648
649 // Indicates if this tab was explicitly closed by the user (control-w, close
650 // tab menu item...). This is false for actions that indirectly close the tab,
651 // such as closing the window. The setter is maintained by TabStripModel, and
652 // the getter only useful from within TAB_CLOSED notification
653 void set_closed_by_user_gesture(bool value) {
654 closed_by_user_gesture_ = value;
655 }
656 bool closed_by_user_gesture() const { return closed_by_user_gesture_; }
657
658 // Overridden from JavaScriptAppModalDialogDelegate:
659 virtual void OnMessageBoxClosed(IPC::Message* reply_msg,
660 bool success,
661 const std::wstring& prompt);
662 virtual void SetSuppressMessageBoxes(bool suppress_message_boxes);
663 virtual gfx::NativeWindow GetMessageBoxRootWindow();
664 virtual TabContents* AsTabContents();
665 virtual ExtensionHost* AsExtensionHost();
666
667 // The BookmarkDragDelegate is used to forward bookmark drag and drop events
668 // to extensions.
669 virtual RenderViewHostDelegate::BookmarkDrag* GetBookmarkDragDelegate();
670
671 // It is up to callers to call SetBookmarkDragDelegate(NULL) when
672 // |bookmark_drag| is deleted since this class does not take ownership of
673 // |bookmark_drag|.
674 virtual void SetBookmarkDragDelegate(
675 RenderViewHostDelegate::BookmarkDrag* bookmark_drag);
676
677 // The TabSpecificContentSettings object is used to query the blocked content
678 // state by various UI elements.
679 TabSpecificContentSettings* GetTabSpecificContentSettings() const;
680
681 // Updates history with the specified navigation. This is called by
682 // OnMsgNavigate to update history state.
683 void UpdateHistoryForNavigation(
684 scoped_refptr<history::HistoryAddPageArgs> add_page_args);
685
686 // Sends the page title to the history service. This is called when we receive
687 // the page title and we know we want to update history.
688 void UpdateHistoryPageTitle(const NavigationEntry& entry);
689
690 // Gets the zoom level for this tab.
691 double GetZoomLevel() const;
692
693 // Gets the zoom percent for this tab.
694 int GetZoomPercent(bool* enable_increment, bool* enable_decrement);
695
696 // Shows a fade effect over this tab contents. Repeated calls will be ignored
697 // until the fade is canceled. If |animate| is true the fade should animate.
698 void FadeForInstant(bool animate);
699
700 // Immediately removes the fade.
701 void CancelInstantFade();
702
703 // Opens view-source tab for this contents.
704 void ViewSource();
705
706 // Gets the minimum/maximum zoom percent.
707 int minimum_zoom_percent() const { return minimum_zoom_percent_; }
708 int maximum_zoom_percent() const { return maximum_zoom_percent_; }
709
710 int content_restrictions() const { return content_restrictions_; }
711
712 AutocompleteHistoryManager* autocomplete_history_manager() {
713 return autocomplete_history_manager_.get();
714 }
715 AutoFillManager* autofill_manager() { return autofill_manager_.get(); }
716
717 safe_browsing::ClientSideDetectionHost* safebrowsing_detection_host() {
718 return safebrowsing_detection_host_.get();
719 }
720
721 protected:
722 // from RenderViewHostDelegate.
723 virtual bool OnMessageReceived(const IPC::Message& message);
724
725 private:
726 friend class NavigationController;
727 // Used to access the child_windows_ (ConstrainedWindowList) for testing
728 // automation purposes.
729 friend class TestingAutomationProvider;
730
731 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, NoJSMessageOnInterstitials);
732 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, UpdateTitle);
733 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, CrossSiteCantPreemptAfterUnload);
734 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
735 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
736 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload);
737
738 // Temporary until the view/contents separation is complete.
739 friend class TabContentsView;
740 #if defined(OS_WIN)
741 friend class TabContentsViewWin;
742 #elif defined(OS_MACOSX)
743 friend class TabContentsViewMac;
744 #elif defined(TOOLKIT_USES_GTK)
745 friend class TabContentsViewGtk;
746 #endif
747
748 // So InterstitialPage can access SetIsLoading.
749 friend class InterstitialPage;
750
751 // TODO(brettw) TestTabContents shouldn't exist!
752 friend class TestTabContents;
753
754 // Used to access the CreateHistoryAddPageArgs member function.
755 friend class ExternalTabContainer;
756
757 // Used to access RVH Delegates.
758 friend class prerender::PrerenderManager;
759
760 // Add all the TabContentObservers.
761 void AddObservers();
762
763 // Message handlers.
764 void OnDidStartProvisionalLoadForFrame(int64 frame_id,
765 bool main_frame,
766 const GURL& url);
767 void OnDidRedirectProvisionalLoad(int32 page_id,
768 const GURL& source_url,
769 const GURL& target_url);
770 void OnDidFailProvisionalLoadWithError(int64 frame_id,
771 bool main_frame,
772 int error_code,
773 const GURL& url,
774 bool showing_repost_interstitial);
775 void OnDidLoadResourceFromMemoryCache(const GURL& url,
776 const std::string& security_info);
777 void OnDidDisplayInsecureContent();
778 void OnDidRunInsecureContent(const std::string& security_origin,
779 const GURL& target_url);
780 void OnDocumentLoadedInFrame(int64 frame_id);
781 void OnDidFinishLoad(int64 frame_id);
782 void OnUpdateContentRestrictions(int restrictions);
783 void OnPDFHasUnsupportedFeature();
784
785 void OnGoToEntryAtOffset(int offset);
786 void OnDidGetApplicationInfo(int32 page_id, const WebApplicationInfo& info);
787 void OnInstallApplication(const WebApplicationInfo& info);
788 void OnPageContents(const GURL& url,
789 int32 page_id,
790 const string16& contents,
791 const std::string& language,
792 bool page_translatable);
793 void OnPageTranslated(int32 page_id,
794 const std::string& original_lang,
795 const std::string& translated_lang,
796 TranslateErrors::Type error_type);
797 void OnSetSuggestions(int32 page_id,
798 const std::vector<std::string>& suggestions);
799 void OnInstantSupportDetermined(int32 page_id, bool result);
800 void OnRunFileChooser(const ViewHostMsg_RunFileChooser_Params& params);
801
802 // Changes the IsLoading state and notifies delegate as needed
803 // |details| is used to provide details on the load that just finished
804 // (but can be null if not applicable). Can be overridden.
805 void SetIsLoading(bool is_loading,
806 LoadNotificationDetails* details);
807
808 // Adds the incoming |new_contents| to the |blocked_contents_| container.
809 void AddPopup(TabContents* new_contents,
810 const gfx::Rect& initial_pos);
811
812 // Called by derived classes to indicate that we're no longer waiting for a
813 // response. This won't actually update the throbber, but it will get picked
814 // up at the next animation step if the throbber is going.
815 void SetNotWaitingForResponse() { waiting_for_response_ = false; }
816
817 ConstrainedWindowList child_windows_;
818
819 // Expires InfoBars that need to be expired, according to the state carried
820 // in |details|, in response to a new NavigationEntry being committed (the
821 // user navigated to another page).
822 void ExpireInfoBars(
823 const NavigationController::LoadCommittedDetails& details);
824
825 // Returns the WebUI for the current state of the tab. This will either be
826 // the pending WebUI, the committed WebUI, or NULL.
827 WebUI* GetWebUIForCurrentState();
828
829 // Navigation helpers --------------------------------------------------------
830 //
831 // These functions are helpers for Navigate() and DidNavigate().
832
833 // Handles post-navigation tasks in DidNavigate AFTER the entry has been
834 // committed to the navigation controller. Note that the navigation entry is
835 // not provided since it may be invalid/changed after being committed. The
836 // current navigation entry is in the NavigationController at this point.
837 void DidNavigateMainFramePostCommit(
838 const NavigationController::LoadCommittedDetails& details,
839 const ViewHostMsg_FrameNavigate_Params& params);
840 void DidNavigateAnyFramePostCommit(
841 RenderViewHost* render_view_host,
842 const NavigationController::LoadCommittedDetails& details,
843 const ViewHostMsg_FrameNavigate_Params& params);
844
845 // Closes all constrained windows.
846 void CloseConstrainedWindows();
847
848 // Send the alternate error page URL to the renderer. This method is virtual
849 // so special html pages can override this (e.g., the new tab page).
850 virtual void UpdateAlternateErrorPageURL();
851
852 // Send webkit specific settings to the renderer.
853 void UpdateWebPreferences();
854
855 // Instruct the renderer to update the zoom level.
856 void UpdateZoomLevel();
857
858 // If our controller was restored and the page id is > than the site
859 // instance's page id, the site instances page id is updated as well as the
860 // renderers max page id.
861 void UpdateMaxPageIDIfNecessary(SiteInstance* site_instance,
862 RenderViewHost* rvh);
863
864 // Returns the history::HistoryAddPageArgs to use for adding a page to
865 // history.
866 scoped_refptr<history::HistoryAddPageArgs> CreateHistoryAddPageArgs(
867 const GURL& virtual_url,
868 const NavigationController::LoadCommittedDetails& details,
869 const ViewHostMsg_FrameNavigate_Params& params);
870
871 // Saves the given title to the navigation entry and does associated work. It
872 // will update history and the view for the new title, and also synthesize
873 // titles for file URLs that have none (so we require that the URL of the
874 // entry already be set).
875 //
876 // This is used as the backend for state updates, which include a new title,
877 // or the dedicated set title message. It returns true if the new title is
878 // different and was therefore updated.
879 bool UpdateTitleForEntry(NavigationEntry* entry, const std::wstring& title);
880
881 // Causes the TabContents to navigate in the right renderer to |entry|, which
882 // must be already part of the entries in the navigation controller.
883 // This does not change the NavigationController state.
884 bool NavigateToEntry(const NavigationEntry& entry,
885 NavigationController::ReloadType reload_type);
886
887 // Misc non-view stuff -------------------------------------------------------
888
889 // Helper functions for sending notifications.
890 void NotifySwapped();
891 void NotifyConnected();
892 void NotifyDisconnected();
893
894 // TabSpecificContentSettings::Delegate implementation.
895 virtual void OnContentSettingsAccessed(bool content_was_blocked);
896
897 // RenderViewHostDelegate ----------------------------------------------------
898
899 // RenderViewHostDelegate implementation.
900 virtual RenderViewHostDelegate::View* GetViewDelegate();
901 virtual RenderViewHostDelegate::RendererManagement*
902 GetRendererManagementDelegate();
903 virtual RenderViewHostDelegate::ContentSettings* GetContentSettingsDelegate();
904 virtual RenderViewHostDelegate::SSL* GetSSLDelegate();
905 virtual AutomationResourceRoutingDelegate*
906 GetAutomationResourceRoutingDelegate();
907 virtual TabContents* GetAsTabContents();
908 virtual ViewType::Type GetRenderViewType() const;
909 virtual int GetBrowserWindowID() const;
910 virtual void RenderViewCreated(RenderViewHost* render_view_host);
911 virtual void RenderViewReady(RenderViewHost* render_view_host);
912 virtual void RenderViewGone(RenderViewHost* render_view_host,
913 base::TerminationStatus status,
914 int error_code);
915 virtual void RenderViewDeleted(RenderViewHost* render_view_host);
916 virtual void DidNavigate(RenderViewHost* render_view_host,
917 const ViewHostMsg_FrameNavigate_Params& params);
918 virtual void UpdateState(RenderViewHost* render_view_host,
919 int32 page_id,
920 const std::string& state);
921 virtual void UpdateTitle(RenderViewHost* render_view_host,
922 int32 page_id,
923 const std::wstring& title);
924 virtual void UpdateEncoding(RenderViewHost* render_view_host,
925 const std::string& encoding);
926 virtual void UpdateTargetURL(int32 page_id, const GURL& url);
927 virtual void UpdateThumbnail(const GURL& url,
928 const SkBitmap& bitmap,
929 const ThumbnailScore& score);
930 virtual void UpdateInspectorSetting(const std::string& key,
931 const std::string& value);
932 virtual void ClearInspectorSettings();
933 virtual void Close(RenderViewHost* render_view_host);
934 virtual void RequestMove(const gfx::Rect& new_bounds);
935 virtual void DidStartLoading();
936 virtual void DidStopLoading();
937 virtual void DidChangeLoadProgress(double progress);
938 virtual void DocumentOnLoadCompletedInMainFrame(
939 RenderViewHost* render_view_host,
940 int32 page_id);
941 virtual void RequestOpenURL(const GURL& url, const GURL& referrer,
942 WindowOpenDisposition disposition);
943 virtual void DomOperationResponse(const std::string& json_string,
944 int automation_id);
945 virtual void ProcessWebUIMessage(const ViewHostMsg_DomMessage_Params& params);
946 virtual void ProcessExternalHostMessage(const std::string& message,
947 const std::string& origin,
948 const std::string& target);
949 virtual void RunJavaScriptMessage(const std::wstring& message,
950 const std::wstring& default_prompt,
951 const GURL& frame_url,
952 const int flags,
953 IPC::Message* reply_msg,
954 bool* did_suppress_message);
955 virtual void RunBeforeUnloadConfirm(const std::wstring& message,
956 IPC::Message* reply_msg);
957 virtual void ShowModalHTMLDialog(const GURL& url, int width, int height,
958 const std::string& json_arguments,
959 IPC::Message* reply_msg);
960 virtual GURL GetAlternateErrorPageURL() const;
961 virtual RendererPreferences GetRendererPrefs(Profile* profile) const;
962 virtual WebPreferences GetWebkitPrefs();
963 virtual void OnUserGesture();
964 virtual void OnIgnoredUIEvent();
965 virtual void OnJSOutOfMemory();
966 virtual void OnCrossSiteResponse(int new_render_process_host_id,
967 int new_request_id);
968 virtual void RendererUnresponsive(RenderViewHost* render_view_host,
969 bool is_during_unload);
970 virtual void RendererResponsive(RenderViewHost* render_view_host);
971 virtual void LoadStateChanged(const GURL& url, net::LoadState load_state,
972 uint64 upload_position, uint64 upload_size);
973 virtual bool IsExternalTabContainer() const;
974 virtual void DidInsertCSS();
975 virtual void FocusedNodeChanged(bool is_editable_node);
976 virtual void UpdateZoomLimits(int minimum_percent,
977 int maximum_percent,
978 bool remember);
979 virtual void WorkerCrashed();
980
981 // RenderViewHostManager::Delegate -------------------------------------------
982
983 // Blocks/unblocks interaction with renderer process.
984 void BlockTabContent(bool blocked);
985
986 virtual void BeforeUnloadFiredFromRenderManager(
987 bool proceed,
988 bool* proceed_to_fire_unload);
989 virtual void DidStartLoadingFromRenderManager(
990 RenderViewHost* render_view_host);
991 virtual void RenderViewGoneFromRenderManager(
992 RenderViewHost* render_view_host);
993 virtual void UpdateRenderViewSizeForRenderManager();
994 virtual void NotifySwappedFromRenderManager();
995 virtual NavigationController& GetControllerForRenderManager();
996 virtual WebUI* CreateWebUIForRenderManager(const GURL& url);
997 virtual NavigationEntry* GetLastCommittedNavigationEntryForRenderManager();
998
999 // Initializes the given renderer if necessary and creates the view ID
1000 // corresponding to this view host. If this method is not called and the
1001 // process is not shared, then the TabContents will act as though the renderer
1002 // is not running (i.e., it will render "sad tab"). This method is
1003 // automatically called from LoadURL.
1004 //
1005 // If you are attaching to an already-existing RenderView, you should call
1006 // InitWithExistingID.
1007 virtual bool CreateRenderViewForRenderManager(
1008 RenderViewHost* render_view_host);
1009
1010 // NotificationObserver ------------------------------------------------------
1011
1012 virtual void Observe(NotificationType type,
1013 const NotificationSource& source,
1014 const NotificationDetails& details);
1015
1016 // App extensions related methods:
1017
1018 // Returns the first extension whose extent contains |url|.
1019 const Extension* GetExtensionContaining(const GURL& url);
1020
1021 // Resets app_icon_ and if |extension| is non-null creates a new
1022 // ImageLoadingTracker to load the extension's image.
1023 void UpdateExtensionAppIcon(const Extension* extension);
1024
1025 // ImageLoadingTracker::Observer.
1026 virtual void OnImageLoaded(SkBitmap* image, ExtensionResource resource,
1027 int index);
1028
1029 // Checks with the PrerenderManager if the specified URL has been preloaded,
1030 // and if so, swap the RenderViewHost with the preload into this TabContents
1031 // object.
1032 bool MaybeUsePreloadedPage(const GURL& url);
1033
1034 // Data for core operation ---------------------------------------------------
1035
1036 // Delegate for notifying our owner about stuff. Not owned by us.
1037 TabContentsDelegate* delegate_;
1038
1039 // Handles the back/forward list and loading.
1040 NavigationController controller_;
1041
1042 // The corresponding view.
1043 scoped_ptr<TabContentsView> view_;
1044
1045 // Helper classes ------------------------------------------------------------
1046
1047 // Manages creation and swapping of render views.
1048 RenderViewHostManager render_manager_;
1049
1050 // Stores random bits of data for others to associate with this object.
1051 PropertyBag property_bag_;
1052
1053 // Registers and unregisters us for notifications.
1054 NotificationRegistrar registrar_;
1055
1056 // Registers and unregisters for pref notifications.
1057 PrefChangeRegistrar pref_change_registrar_;
1058
1059 // Handles print job for this contents.
1060 scoped_ptr<printing::PrintViewManager> printing_;
1061
1062 // Handles print preview for this contents.
1063 scoped_ptr<printing::PrintPreviewMessageHandler> print_preview_;
1064
1065 // SavePackage, lazily created.
1066 scoped_refptr<SavePackage> save_package_;
1067
1068 // AutocompleteHistoryManager.
1069 scoped_ptr<AutocompleteHistoryManager> autocomplete_history_manager_;
1070
1071 // AutoFillManager.
1072 scoped_ptr<AutoFillManager> autofill_manager_;
1073
1074 // Handles plugin messages.
1075 scoped_ptr<PluginObserver> plugin_observer_;
1076
1077 // Prerender PageLoadTime Recorder.
1078 scoped_ptr<prerender::PrerenderPLTRecorder> prerender_plt_recorder_;
1079
1080 // TabContentsSSLHelper, lazily created.
1081 scoped_ptr<TabContentsSSLHelper> ssl_helper_;
1082
1083 // FileSelectHelper, lazily created.
1084 scoped_ptr<FileSelectHelper> file_select_helper_;
1085
1086 // Handles drag and drop event forwarding to extensions.
1087 BookmarkDrag* bookmark_drag_;
1088
1089 // Handles downloading favicons.
1090 scoped_ptr<FavIconHelper> fav_icon_helper_;
1091
1092 // Cached web app info data.
1093 WebApplicationInfo web_app_info_;
1094
1095 // Cached web app icon.
1096 SkBitmap app_icon_;
1097
1098 // RenderViewHost::ContentSettingsDelegate.
1099 scoped_ptr<TabSpecificContentSettings> content_settings_delegate_;
1100
1101 // Handles desktop notification IPCs.
1102 scoped_ptr<DesktopNotificationHandlerForTC> desktop_notification_handler_;
1103
1104 // Handles IPCs related to SafeBrowsing client-side phishing detection.
1105 scoped_ptr<safe_browsing::ClientSideDetectionHost>
1106 safebrowsing_detection_host_;
1107
1108 // Data for loading state ----------------------------------------------------
1109
1110 // Indicates whether we're currently loading a resource.
1111 bool is_loading_;
1112
1113 // Indicates if the tab is considered crashed.
1114 base::TerminationStatus crashed_status_;
1115 int crashed_error_code_;
1116
1117 // See waiting_for_response() above.
1118 bool waiting_for_response_;
1119
1120 // Indicates the largest PageID we've seen. This field is ignored if we are
1121 // a TabContents, in which case the max page ID is stored separately with
1122 // each SiteInstance.
1123 // TODO(brettw) this seems like it can be removed according to the comment.
1124 int32 max_page_id_;
1125
1126 // System time at which the current load was started.
1127 base::TimeTicks current_load_start_;
1128
1129 // The current load state and the URL associated with it.
1130 net::LoadState load_state_;
1131 string16 load_state_host_;
1132 // Upload progress, for displaying in the status bar.
1133 // Set to zero when there is no significant upload happening.
1134 uint64 upload_size_;
1135 uint64 upload_position_;
1136
1137 // Data for current page -----------------------------------------------------
1138
1139 // Whether we have a (non-empty) title for the current page.
1140 // Used to prevent subsequent title updates from affecting history. This
1141 // prevents some weirdness because some AJAXy apps use titles for status
1142 // messages.
1143 bool received_page_title_;
1144
1145 // When a navigation occurs, we record its contents MIME type. It can be
1146 // used to check whether we can do something for some special contents.
1147 std::string contents_mime_type_;
1148
1149 // Character encoding.
1150 std::string encoding_;
1151
1152 // Object that holds any blocked TabContents spawned from this TabContents.
1153 BlockedContentContainer* blocked_contents_;
1154
1155 // Should we block all child TabContents this attempts to spawn.
1156 bool all_contents_blocked_;
1157
1158 // TODO(pkasting): Hack to try and fix Linux browser tests.
1159 bool dont_notify_render_view_;
1160
1161 // True if this is a secure page which displayed insecure content.
1162 bool displayed_insecure_content_;
1163
1164 // Data for shelves and stuff ------------------------------------------------
1165
1166 // Delegates for InfoBars associated with this TabContents.
1167 std::vector<InfoBarDelegate*> infobar_delegates_;
1168
1169 // Data for app extensions ---------------------------------------------------
1170
1171 // If non-null this tab is an app tab and this is the extension the tab was
1172 // created for.
1173 const Extension* extension_app_;
1174
1175 // Icon for extension_app_ (if non-null) or extension_for_current_page_.
1176 SkBitmap extension_app_icon_;
1177
1178 // Used for loading extension_app_icon_.
1179 scoped_ptr<ImageLoadingTracker> extension_app_image_loader_;
1180
1181 // Data for misc internal state ----------------------------------------------
1182
1183 // See capturing_contents() above.
1184 bool capturing_contents_;
1185
1186 // See getter above.
1187 bool is_being_destroyed_;
1188
1189 // Indicates whether we should notify about disconnection of this
1190 // TabContents. This is used to ensure disconnection notifications only
1191 // happen if a connection notification has happened and that they happen only
1192 // once.
1193 bool notify_disconnection_;
1194
1195 // Maps from handle to page_id.
1196 typedef std::map<FaviconService::Handle, int32> HistoryRequestMap;
1197 HistoryRequestMap history_requests_;
1198
1199 #if defined(OS_WIN)
1200 // Handle to an event that's set when the page is showing a message box (or
1201 // equivalent constrained window). Plugin processes check this to know if
1202 // they should pump messages then.
1203 base::win::ScopedHandle message_box_active_;
1204 #endif
1205
1206 // The time that the last javascript message was dismissed.
1207 base::TimeTicks last_javascript_message_dismissal_;
1208
1209 // True if the user has decided to block future javascript messages. This is
1210 // reset on navigations to false on navigations.
1211 bool suppress_javascript_messages_;
1212
1213 // Set to true when there is an active "before unload" dialog. When true,
1214 // we've forced the throbber to start in Navigate, and we need to remember to
1215 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
1216 bool is_showing_before_unload_dialog_;
1217
1218 // Shows an info-bar to users when they search from a known search engine and
1219 // have never used the monibox for search before.
1220 scoped_ptr<OmniboxSearchHint> omnibox_search_hint_;
1221
1222 // Settings that get passed to the renderer process.
1223 RendererPreferences renderer_preferences_;
1224
1225 // If this tab was created from a renderer using window.open, this will be
1226 // non-NULL and represent the WebUI of the opening renderer.
1227 WebUITypeID opener_web_ui_type_;
1228
1229 // The time that we started to create the new tab page.
1230 base::TimeTicks new_tab_start_time_;
1231
1232 // The time that we started to close the tab.
1233 base::TimeTicks tab_close_start_time_;
1234
1235 // The time that this tab was last selected.
1236 base::TimeTicks last_selected_time_;
1237
1238 // Information about the language the page is in and has been translated to.
1239 LanguageState language_state_;
1240
1241 // See description above setter.
1242 bool closed_by_user_gesture_;
1243
1244 // Minimum/maximum zoom percent.
1245 int minimum_zoom_percent_;
1246 int maximum_zoom_percent_;
1247 // If true, the default zoom limits have been overriden for this tab, in which
1248 // case we don't want saved settings to apply to it and we don't want to
1249 // remember it.
1250 bool temporary_zoom_settings_;
1251
1252 // A list of observers notified when page state changes. Weak references.
1253 ObserverList<TabContentsObserver> observers_;
1254
1255 // Content restrictions, used to disable print/copy etc based on content's
1256 // (full-page plugins for now only) permissions.
1257 int content_restrictions_;
1258
1259 DISALLOW_COPY_AND_ASSIGN(TabContents);
1260 };
1261 11
1262 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ 12 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_host_manager_unittest.cc ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698