diff options
-rw-r--r-- | chrome/browser/debugger/devtools_manager.cc | 50 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_manager.h | 26 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 373 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.h | 68 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.cc | 364 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.h | 44 |
6 files changed, 447 insertions, 478 deletions
diff --git a/chrome/browser/debugger/devtools_manager.cc b/chrome/browser/debugger/devtools_manager.cc index 6afa7a3..b18b9af 100644 --- a/chrome/browser/debugger/devtools_manager.cc +++ b/chrome/browser/debugger/devtools_manager.cc @@ -13,11 +13,11 @@ #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_type.h" -DevToolsManager::DevToolsManager() : web_contents_listeners_(NULL) { +DevToolsManager::DevToolsManager() : tab_contents_listeners_(NULL) { } DevToolsManager::~DevToolsManager() { - DCHECK(!web_contents_listeners_.get()) << + DCHECK(!tab_contents_listeners_.get()) << "All devtools client hosts must alredy have been destroyed."; DCHECK(navcontroller_to_client_host_.empty()); DCHECK(client_host_to_navcontroller_.empty()); @@ -29,7 +29,7 @@ void DevToolsManager::Observe(NotificationType type, DCHECK(type == NotificationType::WEB_CONTENTS_DISCONNECTED); if (type == NotificationType::WEB_CONTENTS_DISCONNECTED) { - Source<WebContents> src(source); + Source<TabContents> src(source); DevToolsClientHost* client_host = GetDevToolsClientHostFor(*src.ptr()); if (!client_host) { return; @@ -43,8 +43,8 @@ void DevToolsManager::Observe(NotificationType type, } DevToolsClientHost* DevToolsManager::GetDevToolsClientHostFor( - const WebContents& web_contents) { - const NavigationController& navigation_controller = web_contents.controller(); + const TabContents& tab_contents) { + const NavigationController& navigation_controller = tab_contents.controller(); ClientHostMap::const_iterator it = navcontroller_to_client_host_.find(&navigation_controller); if (it != navcontroller_to_client_host_.end()) { @@ -54,17 +54,17 @@ DevToolsClientHost* DevToolsManager::GetDevToolsClientHostFor( } void DevToolsManager::RegisterDevToolsClientHostFor( - WebContents& web_contents, + TabContents& tab_contents, DevToolsClientHost* client_host) { - DCHECK(!GetDevToolsClientHostFor(web_contents)); + DCHECK(!GetDevToolsClientHostFor(tab_contents)); - NavigationController* navigation_controller = &web_contents.controller(); + NavigationController* navigation_controller = &tab_contents.controller(); navcontroller_to_client_host_[navigation_controller] = client_host; client_host_to_navcontroller_[client_host] = navigation_controller; client_host->set_close_listener(this); StartListening(navigation_controller); - SendAttachToAgent(web_contents, web_contents.render_view_host()); + SendAttachToAgent(tab_contents, tab_contents.render_view_host()); } void DevToolsManager::ForwardToDevToolsAgent( @@ -99,11 +99,7 @@ void DevToolsManager::ForwardToDevToolsAgent(const DevToolsClientHost& from, if (!tc) { return; } - WebContents* wc = tc->AsWebContents(); - if (!wc) { - return; - } - RenderViewHost* target_host = wc->render_view_host(); + RenderViewHost* target_host = tc->render_view_host(); if (!target_host) { return; } @@ -115,7 +111,7 @@ void DevToolsManager::ForwardToDevToolsAgent(const DevToolsClientHost& from, void DevToolsManager::ForwardToDevToolsClient(const RenderViewHost& from, const IPC::Message& message) { - WebContents* wc = from.delegate()->GetAsWebContents(); + TabContents* wc = from.delegate()->GetAsWebContents(); if (!wc) { NOTREACHED(); return; @@ -129,7 +125,7 @@ void DevToolsManager::ForwardToDevToolsClient(const RenderViewHost& from, target_host->SendMessageToClient(message); } -void DevToolsManager::OpenDevToolsWindow(WebContents* wc) { +void DevToolsManager::OpenDevToolsWindow(TabContents* wc) { DevToolsClientHost* host = GetDevToolsClientHostFor(*wc); if (!host) { host = DevToolsWindow::Create(); @@ -140,7 +136,7 @@ void DevToolsManager::OpenDevToolsWindow(WebContents* wc) { window->Show(); } -void DevToolsManager::InspectElement(WebContents* wc, int x, int y) { +void DevToolsManager::InspectElement(TabContents* wc, int x, int y) { OpenDevToolsWindow(wc); RenderViewHost* target_host = wc->render_view_host(); if (!target_host) { @@ -162,11 +158,7 @@ void DevToolsManager::ClientHostClosing(DevToolsClientHost* host) { if (!tab_contents) { return; } - WebContents* web_contents = tab_contents->AsWebContents(); - if (!web_contents) { - return; - } - SendDetachToAgent(*web_contents); + SendDetachToAgent(*tab_contents); UnregisterDevToolsClientHost(host, controller); } @@ -191,9 +183,9 @@ void DevToolsManager::UnregisterDevToolsClientHost( void DevToolsManager::StartListening( NavigationController* navigation_controller) { // TODO(yurys): add render host change listener - if (!web_contents_listeners_.get()) { - web_contents_listeners_.reset(new NotificationRegistrar); - web_contents_listeners_->Add( + if (!tab_contents_listeners_.get()) { + tab_contents_listeners_.reset(new NotificationRegistrar); + tab_contents_listeners_->Add( this, NotificationType::WEB_CONTENTS_DISCONNECTED, NotificationService::AllSources()); @@ -202,14 +194,14 @@ void DevToolsManager::StartListening( void DevToolsManager::StopListening( NavigationController* navigation_controller) { - DCHECK(web_contents_listeners_.get()); + DCHECK(tab_contents_listeners_.get()); if (navcontroller_to_client_host_.empty()) { DCHECK(client_host_to_navcontroller_.empty()); - web_contents_listeners_.reset(); + tab_contents_listeners_.reset(); } } -void DevToolsManager::SendAttachToAgent(const WebContents& wc, +void DevToolsManager::SendAttachToAgent(const TabContents& wc, RenderViewHost* target_host) { if (GetDevToolsClientHostFor(wc) && target_host) { IPC::Message* m = new DevToolsAgentMsg_Attach(); @@ -218,7 +210,7 @@ void DevToolsManager::SendAttachToAgent(const WebContents& wc, } } -void DevToolsManager::SendDetachToAgent(const WebContents& wc) { +void DevToolsManager::SendDetachToAgent(const TabContents& wc) { RenderViewHost* target_host = wc.render_view_host(); if (target_host) { IPC::Message* m = new DevToolsAgentMsg_Detach(); diff --git a/chrome/browser/debugger/devtools_manager.h b/chrome/browser/debugger/devtools_manager.h index 77ffaf5..143b7f4 100644 --- a/chrome/browser/debugger/devtools_manager.h +++ b/chrome/browser/debugger/devtools_manager.h @@ -20,7 +20,7 @@ class DevToolsClientHost; class NavigationController; class NotificationRegistrar; class RenderViewHost; -class WebContents; +class TabContents; // This class is a singleton that manages DevToolsClientHost instances and // routes messages between developer tools clients and agents. @@ -30,13 +30,13 @@ class DevToolsManager : public NotificationObserver, DevToolsManager(); virtual ~DevToolsManager(); - // Returns DevToolsClientHost registered for |web_contents| or NULL if - // there is no alive DevToolsClientHost registered for |web_contents|. - DevToolsClientHost* GetDevToolsClientHostFor(const WebContents& web_contents); + // Returns DevToolsClientHost registered for |tab_contents| or NULL if + // there is no alive DevToolsClientHost registered for |tab_contents|. + DevToolsClientHost* GetDevToolsClientHostFor(const TabContents& tab_contents); - // Registers new DevToolsClientHost for |web_contents|. There must be no - // other DevToolsClientHosts registered for the WebContents at the moment. - void RegisterDevToolsClientHostFor(WebContents& web_contents, + // Registers new DevToolsClientHost for |tab_contents|. There must be no + // other DevToolsClientHosts registered for the TabContents at the moment. + void RegisterDevToolsClientHostFor(TabContents& tab_contents, DevToolsClientHost* client_host); void ForwardToDevToolsAgent(const RenderViewHost& client_rvh, @@ -46,17 +46,17 @@ class DevToolsManager : public NotificationObserver, void ForwardToDevToolsClient(const RenderViewHost& from, const IPC::Message& message); - void OpenDevToolsWindow(WebContents* wc); + void OpenDevToolsWindow(TabContents* wc); // Starts element inspection in the devtools client. // Creates one by means of OpenDevToolsWindow if no client // exists. - void InspectElement(WebContents* web_contents, int x, int y); + void InspectElement(TabContents* tab_contents, int x, int y); // Sends 'Attach' message to the agent using |target_host| in case - // there is a DevToolsClientHost registered for the |web_contents|. + // there is a DevToolsClientHost registered for the |tab_contents|. void SendAttachToAgent( - const WebContents& web_contents, + const TabContents& tab_contents, RenderViewHost* target_host); private: @@ -81,11 +81,11 @@ private: NavigationController* navigation_controller); void StartListening(NavigationController* navigation_controller); void StopListening(NavigationController* navigation_controller); - void SendDetachToAgent(const WebContents& web_contents); + void SendDetachToAgent(const TabContents& tab_contents); // This object is not NULL iff there is at least one registered // DevToolsClientHost. - scoped_ptr<NotificationRegistrar> web_contents_listeners_; + scoped_ptr<NotificationRegistrar> tab_contents_listeners_; // These two maps are for tracking dependencies between inspected tabs and // their DevToolsClientHosts. They are usful for routing devtools messages diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index fcf7bdd..a550414 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -4,12 +4,20 @@ #include "chrome/browser/tab_contents/tab_contents.h" +#include "base/string16.h" +#include "base/time.h" #include "chrome/browser/autofill_manager.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/cert_store.h" +#include "chrome/browser/debugger/devtools_manager.h" +#include "chrome/browser/dom_ui/dom_ui.h" +#include "chrome/browser/dom_ui/dom_ui_factory.h" #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/download_shelf.h" #include "chrome/browser/password_manager/password_manager.h" #include "chrome/browser/plugin_installer.h" +#include "chrome/browser/renderer_host/render_widget_host_view.h" +#include "chrome/browser/renderer_host/web_cache_manager.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "chrome/browser/tab_contents/tab_contents_view.h" @@ -18,6 +26,7 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" +#include "chrome/common/url_constants.h" #include "grit/generated_resources.h" #if defined(OS_WIN) @@ -123,6 +132,38 @@ const GURL& TabContents::GetURL() const { return entry ? entry->display_url() : GURL::EmptyGURL(); } +const string16& TabContents::GetTitle() const { + DOMUI* our_dom_ui = render_manager_.pending_dom_ui() ? + render_manager_.pending_dom_ui() : render_manager_.dom_ui(); + if (our_dom_ui) { + // Don't override the title in view source mode. + NavigationEntry* entry = controller_.GetActiveEntry(); + if (!(entry && entry->IsViewSourceMode())) { + // Give the DOM UI the chance to override our title. + const string16& title = our_dom_ui->overridden_title(); + if (!title.empty()) + return title; + } + } + + // We use the title for the last committed entry rather than a pending + // navigation entry. For example, when the user types in a URL, we want to + // keep the old page's title until the new load has committed and we get a new + // title. + // The exception is with transient pages, for which we really want to use + // their title, as they are not committed. + NavigationEntry* entry = controller_.GetTransientEntry(); + if (entry) + return entry->GetTitleForDisplay(&controller_); + + entry = controller_.GetLastCommittedEntry(); + if (entry) + return entry->GetTitleForDisplay(&controller_); + else if (controller_.LoadingURLLazily()) + return controller_.GetLazyTitle(); + return EmptyString16(); +} + int32 TabContents::GetMaxPageID() { if (GetSiteInstance()) return GetSiteInstance()->max_page_id(); @@ -143,10 +184,25 @@ void TabContents::UpdateMaxPageID(int32 page_id) { max_page_id_ = std::max(max_page_id_, page_id); } +SiteInstance* TabContents::GetSiteInstance() const { + return render_manager_.current_host()->site_instance(); +} + const std::wstring TabContents::GetDefaultTitle() const { return l10n_util::GetString(IDS_DEFAULT_TAB_TITLE); } +bool TabContents::ShouldDisplayURL() { + // Don't hide the url in view source mode. + NavigationEntry* entry = controller_.GetActiveEntry(); + if (entry && entry->IsViewSourceMode()) + return true; + DOMUI* dom_ui = GetDOMUIForCurrentState(); + if (dom_ui) + return !dom_ui->should_hide_url(); + return true; +} + SkBitmap TabContents::GetFavIcon() const { // Like GetTitle(), we also want to use the favicon for the last committed // entry rather than a pending navigation entry. @@ -162,6 +218,17 @@ SkBitmap TabContents::GetFavIcon() const { return SkBitmap(); } +bool TabContents::ShouldDisplayFavIcon() { + // Always display a throbber during pending loads. + if (controller_.GetLastCommittedEntry() && controller_.pending_entry()) + return true; + + DOMUI* dom_ui = GetDOMUIForCurrentState(); + if (dom_ui) + return !dom_ui->hide_favicon(); + return true; +} + #if defined(OS_WIN) SecurityStyle TabContents::GetSecurityStyle() const { // We may not have a navigation entry yet. @@ -192,6 +259,33 @@ bool TabContents::GetSSLEVText(std::wstring* ev_text, } #endif +std::wstring TabContents::GetStatusText() const { + if (!is_loading() || load_state_ == net::LOAD_STATE_IDLE) + return std::wstring(); + + switch (load_state_) { + case net::LOAD_STATE_WAITING_FOR_CACHE: + return l10n_util::GetString(IDS_LOAD_STATE_WAITING_FOR_CACHE); + case net::LOAD_STATE_RESOLVING_PROXY_FOR_URL: + return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_PROXY_FOR_URL); + case net::LOAD_STATE_RESOLVING_HOST: + return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_HOST); + case net::LOAD_STATE_CONNECTING: + return l10n_util::GetString(IDS_LOAD_STATE_CONNECTING); + case net::LOAD_STATE_SENDING_REQUEST: + return l10n_util::GetString(IDS_LOAD_STATE_SENDING_REQUEST); + case net::LOAD_STATE_WAITING_FOR_RESPONSE: + return l10n_util::GetStringF(IDS_LOAD_STATE_WAITING_FOR_RESPONSE, + load_state_host_); + // Ignore net::LOAD_STATE_READING_RESPONSE and net::LOAD_STATE_IDLE + case net::LOAD_STATE_IDLE: + case net::LOAD_STATE_READING_RESPONSE: + break; + } + + return std::wstring(); +} + void TabContents::SetIsCrashed(bool state) { if (state == is_crashed_) return; @@ -206,11 +300,69 @@ void TabContents::NotifyNavigationStateChanged(unsigned changed_flags) { delegate_->NavigationStateChanged(this, changed_flags); } +void TabContents::DidBecomeSelected() { + controller_.SetActive(true); + + if (render_widget_host_view()) + render_widget_host_view()->DidBecomeSelected(); + + // If pid() is -1, that means the RenderProcessHost still hasn't been + // initialized. It'll register with CacheManagerHost when it is. + if (process()->pid() != -1) + WebCacheManager::GetInstance()->ObserveActivity(process()->pid()); +} + +void TabContents::WasHidden() { + if (!capturing_contents()) { + // |render_view_host()| can be NULL if the user middle clicks a link to open + // a tab in then background, then closes the tab before selecting it. This + // is because closing the tab calls TabContents::Destroy(), which removes + // the |render_view_host()|; then when we actually destroy the window, + // OnWindowPosChanged() notices and calls HideContents() (which calls us). + if (render_widget_host_view()) + render_widget_host_view()->WasHidden(); + + // Loop through children and send WasHidden to them, too. + int count = static_cast<int>(child_windows_.size()); + for (int i = count - 1; i >= 0; --i) { + ConstrainedWindow* window = child_windows_.at(i); + window->WasHidden(); + } + } + + NotificationService::current()->Notify( + NotificationType::TAB_CONTENTS_HIDDEN, + Source<TabContents>(this), + NotificationService::NoDetails()); +} + void TabContents::Activate() { if (delegate_) delegate_->ActivateContents(this); } +void TabContents::ShowContents() { + if (render_widget_host_view()) + render_widget_host_view()->DidBecomeSelected(); + + // Loop through children and send DidBecomeSelected to them, too. + int count = static_cast<int>(child_windows_.size()); + for (int i = count - 1; i >= 0; --i) { + ConstrainedWindow* window = child_windows_.at(i); + window->DidBecomeSelected(); + } +} + +void TabContents::HideContents() { + // TODO(pkasting): http://b/1239839 Right now we purposefully don't call + // our superclass HideContents(), because some callers want to be very picky + // about the order in which these get called. In addition to making the code + // here practically impossible to understand, this also means we end up + // calling TabContents::WasHidden() twice if callers call both versions of + // HideContents() on a WebContents. + WasHidden(); +} + void TabContents::OpenURL(const GURL& url, const GURL& referrer, WindowOpenDisposition disposition, PageTransition::Type transition) { @@ -219,13 +371,80 @@ void TabContents::OpenURL(const GURL& url, const GURL& referrer, } bool TabContents::NavigateToPendingEntry(bool reload) { - // Our benavior is just to report that the entry was committed. - string16 default_title = WideToUTF16Hack(GetDefaultTitle()); - controller_.pending_entry()->set_title(default_title); - controller_.CommitPendingEntry(); + const NavigationEntry& entry = *controller_.pending_entry(); + + RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry); + if (!dest_render_view_host) + return false; // Unable to create the desired render view host. + + // Tell DevTools agent that it is attached prior to the navigation. + DevToolsManager* dev_tools_manager = g_browser_process->devtools_manager(); + if (dev_tools_manager) // NULL in unit tests. + dev_tools_manager->SendAttachToAgent(*this, dest_render_view_host); + + // Used for page load time metrics. + current_load_start_ = base::TimeTicks::Now(); + + // Navigate in the desired RenderViewHost. + dest_render_view_host->NavigateToEntry(entry, reload); + + if (entry.page_id() == -1) { + // HACK!! This code suppresses javascript: URLs from being added to + // session history, which is what we want to do for javascript: URLs that + // do not generate content. What we really need is a message from the + // renderer telling us that a new page was not created. The same message + // could be used for mailto: URLs and the like. + if (entry.url().SchemeIs(chrome::kJavaScriptScheme)) + return false; + } + + // Clear any provisional password saves - this stops password infobars + // showing up on pages the user navigates to while the right page is + // loading. + GetPasswordManager()->ClearProvisionalSave(); + + if (reload && !profile()->IsOffTheRecord()) { + HistoryService* history = + profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); + if (history) + history->SetFavIconOutOfDateForPage(entry.url()); + } + return true; } +void TabContents::Stop() { + render_manager_.Stop(); + printing_.Stop(); +} + +void TabContents::Cut() { + render_view_host()->Cut(); +} + +void TabContents::Copy() { + render_view_host()->Copy(); +} + +void TabContents::Paste() { + render_view_host()->Paste(); +} + +void TabContents::DisassociateFromPopupCount() { + render_view_host()->DisassociateFromPopupCount(); +} + +TabContents* TabContents::Clone() { + // We create a new SiteInstance so that the new tab won't share processes + // with the old one. This can be changed in the future if we need it to share + // processes for some reason. + TabContents* tc = new WebContents(profile(), + SiteInstance::CreateSiteInstance(profile()), + MSG_ROUTING_NONE, NULL); + tc->controller().CopyStateFrom(controller_); + return tc; +} + #if defined(OS_WIN) ConstrainedWindow* TabContents::CreateConstrainedDialog( views::WindowDelegate* window_delegate, @@ -294,6 +513,37 @@ void TabContents::CloseAllSuppressedPopups() { } #endif +void TabContents::PopupNotificationVisibilityChanged(bool visible) { + render_view_host()->PopupNotificationVisibilityChanged(visible); +} + +gfx::NativeView TabContents::GetContentNativeView() { + return view_->GetContentNativeView(); +} + +gfx::NativeView TabContents::GetNativeView() const { + return view_->GetNativeView(); +} + +void TabContents::GetContainerBounds(gfx::Rect *out) const { + view_->GetContainerBounds(out); +} + +void TabContents::Focus() { + view_->Focus(); +} + +void TabContents::SetInitialFocus(bool reverse) { + render_view_host()->SetInitialFocus(reverse); +} + +bool TabContents::FocusLocationBarByDefault() { + DOMUI* dom_ui = GetDOMUIForCurrentState(); + if (dom_ui) + return dom_ui->focus_location_bar_by_default(); + return false; +} + void TabContents::AddInfoBar(InfoBarDelegate* delegate) { // Look through the existing InfoBarDelegates we have for a match. If we've // already got one that matches, then we don't add the new one. @@ -336,6 +586,51 @@ void TabContents::RemoveInfoBar(InfoBarDelegate* delegate) { } } +bool TabContents::IsBookmarkBarAlwaysVisible() { + // See GetDOMUIForCurrentState() comment for more info. This case is very + // similar, but for non-first loads, we want to use the committed entry. This + // is so the bookmarks bar disappears at the same time the page does. + if (controller_.GetLastCommittedEntry()) { + // Not the first load, always use the committed DOM UI. + if (render_manager_.dom_ui()) + return render_manager_.dom_ui()->force_bookmark_bar_visible(); + return false; // Default. + } + + // When it's the first load, we know either the pending one or the committed + // one will have the DOM UI in it (see GetDOMUIForCurrentState), and only one + // of them will be valid, so we can just check both. + if (render_manager_.pending_dom_ui()) + return render_manager_.pending_dom_ui()->force_bookmark_bar_visible(); + if (render_manager_.dom_ui()) + return render_manager_.dom_ui()->force_bookmark_bar_visible(); + return false; // Default. +} + +void TabContents::SetDownloadShelfVisible(bool visible) { + if (shelf_visible_ != visible) { + if (visible) { + // Invoke GetDownloadShelf to force the shelf to be created. + GetDownloadShelf(); + } + shelf_visible_ = visible; + + if (delegate_) + delegate_->ContentsStateChanged(this); + } + + // SetShelfVisible can force-close the shelf, so make sure we lay out + // everything correctly, as if the animation had finished. This doesn't + // matter for showing the shelf, as the show animation will do it. + ToolbarSizeChanged(false); + + if (visible) { + // Always set this value as it reflects the last time the download shelf + // was made visible (even if it was already visible). + last_download_shelf_show_ = base::TimeTicks::Now(); + } +} + void TabContents::ToolbarSizeChanged(bool is_animating) { TabContentsDelegate* d = delegate(); if (d) @@ -459,6 +754,36 @@ void TabContents::StopFinding(bool clear_selection) { render_view_host()->StopFinding(clear_selection); } +// Notifies the RenderWidgetHost instance about the fact that the page is +// loading, or done loading and calls the base implementation. +void TabContents::SetIsLoading(bool is_loading, + LoadNotificationDetails* details) { + if (is_loading == is_loading_) + return; + + if (!is_loading) { + load_state_ = net::LOAD_STATE_IDLE; + load_state_host_.clear(); + } + + render_manager_.SetIsLoading(is_loading); + + is_loading_ = is_loading; + waiting_for_response_ = is_loading; + + if (delegate_) + delegate_->LoadingStateChanged(this); + + NotificationType type = is_loading ? NotificationType::LOAD_START : + NotificationType::LOAD_STOP; + NotificationDetails det = NotificationService::NoDetails();; + if (details) + det = Details<LoadNotificationDetails>(details); + NotificationService::current()->Notify(type, + Source<NavigationController>(&controller_), + det); +} + #if defined(OS_WIN) // TODO(brettw) This should be on the TabContentsView. void TabContents::RepositionSupressedPopupsToFit(const gfx::Size& new_size) { @@ -520,3 +845,43 @@ void TabContents::OnGearsCreateShortcutDone( pending_install_.page_id = 0; pending_install_.callback_functor = NULL; } + +DOMUI* TabContents::GetDOMUIForCurrentState() { + // When there is a pending navigation entry, we want to use the pending DOMUI + // that goes along with it to control the basic flags. For example, we want to + // show the pending URL in the URL bar, so we want the display_url flag to + // be from the pending entry. + // + // The confusion comes because there are multiple possibilities for the + // initial load in a tab as a side effect of the way the RenderViewHostManager + // works. + // + // - For the very first tab the load looks "normal". The new tab DOM UI is + // the pending one, and we want it to apply here. + // + // - For subsequent new tabs, they'll get a new SiteInstance which will then + // get switched to the one previously associated with the new tab pages. + // This switching will cause the manager to commit the RVH/DOMUI. So we'll + // have a committed DOM UI in this case. + // + // This condition handles all of these cases: + // + // - First load in first tab: no committed nav entry + pending nav entry + + // pending dom ui: + // -> Use pending DOM UI if any. + // + // - First load in second tab: no committed nav entry + pending nav entry + + // no pending DOM UI: + // -> Use the committed DOM UI if any. + // + // - Second navigation in any tab: committed nav entry + pending nav entry: + // -> Use pending DOM UI if any. + // + // - Normal state with no load: committed nav entry + no pending nav entry: + // -> Use committed DOM UI. + if (controller_.pending_entry() && + (controller_.GetLastCommittedEntry() || + render_manager_.pending_dom_ui())) + return render_manager_.pending_dom_ui(); + return render_manager_.dom_ui(); +} diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index 8fe5529..71559cb 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -178,7 +178,7 @@ class TabContents : public PageNavigator, // pending may be provisional (e.g., the navigation could result in a // download, in which case the URL would revert to what it was previously). const GURL& GetURL() const; - virtual const string16& GetTitle() const = 0; + virtual const string16& GetTitle() const; // The max PageID of any page that this TabContents has loaded. PageIDs // increase with each new page that is loaded by a tab. If this is a @@ -192,7 +192,7 @@ class TabContents : public PageNavigator, // Returns the site instance associated with the current page. By default, // there is no site instance. WebContents overrides this to provide proper // access to its site instance. - virtual SiteInstance* GetSiteInstance() const = 0; + virtual SiteInstance* GetSiteInstance() const; // Initial title assigned to NavigationEntries from Navigate. const std::wstring GetDefaultTitle() const; @@ -201,7 +201,7 @@ class TabContents : public PageNavigator, // bar. Normally this is true so you can see the URL. This is set to false // for the new tab page and related pages so that the URL bar is empty and // the user is invited to type into it. - virtual bool ShouldDisplayURL() = 0; + virtual bool ShouldDisplayURL(); // Returns the favicon for this tab, or an isNull() bitmap if the tab does not // have a favicon. The default implementation uses the current navigation @@ -210,7 +210,7 @@ class TabContents : public PageNavigator, // Returns whether the favicon should be displayed. If this returns false, no // space is provided for the favicon, and the favicon is never displayed. - virtual bool ShouldDisplayFavIcon() = 0; + virtual bool ShouldDisplayFavIcon(); // SSL related states. SecurityStyle GetSecurityStyle() const; @@ -222,7 +222,7 @@ class TabContents : public PageNavigator, bool GetSSLEVText(std::wstring* ev_text, std::wstring* ev_tooltip_text) const; // Returns a human-readable description the tab's loading state. - virtual std::wstring GetStatusText() const = 0; + virtual std::wstring GetStatusText() const; // Return whether this tab contents is loading a resource. bool is_loading() const { return is_loading_; } @@ -262,16 +262,20 @@ class TabContents : public PageNavigator, // Invoked when the tab contents becomes selected. If you override, be sure // and invoke super's implementation. - virtual void DidBecomeSelected() = 0; + virtual void DidBecomeSelected(); // Invoked when the tab contents becomes hidden. // NOTE: If you override this, call the superclass version too! - virtual void WasHidden() = 0; + virtual void WasHidden(); // Activates this contents within its containing window, bringing that window // to the foreground if necessary. void Activate(); + // TODO(brettw) document these. + virtual void ShowContents(); + virtual void HideContents(); + // Commands ------------------------------------------------------------------ // Implementation of PageNavigator. @@ -290,10 +294,10 @@ class TabContents : public PageNavigator, // // If this method returns false, then the navigation is discarded (equivalent // to calling DiscardPendingEntry on the NavigationController). - virtual bool NavigateToPendingEntry(bool reload) = 0; + virtual bool NavigateToPendingEntry(bool reload); // Stop any pending navigation. - virtual void Stop() = 0; + virtual void Stop(); // TODO(erg): HACK ALERT! This was thrown together for beta and // needs to be completely removed after we ship it. Right now, the @@ -302,16 +306,16 @@ class TabContents : public PageNavigator, // TabContents. Post-beta, this needs to be replaced with a unified // interface for supporting cut/copy/paste, and managing who has // cut/copy/paste focus. (http://b/1117225) - virtual void Cut() = 0; - virtual void Copy() = 0; - virtual void Paste() = 0; + virtual void Cut(); + virtual void Copy(); + virtual void Paste(); // Called on a TabContents when it isn't a popup, but a new window. - virtual void DisassociateFromPopupCount() = 0; + virtual void DisassociateFromPopupCount(); // Creates a new TabContents with the same state as this one. The returned // heap-allocated pointer is owned by the caller. - virtual TabContents* Clone() = 0; + virtual TabContents* Clone(); // Window management --------------------------------------------------------- @@ -344,22 +348,24 @@ class TabContents : public PageNavigator, void CloseAllSuppressedPopups(); // Called when the blocked popup notification is shown or hidden. - virtual void PopupNotificationVisibilityChanged(bool visible) = 0; + virtual void PopupNotificationVisibilityChanged(bool visible); // Views and focus ----------------------------------------------------------- + // TODO(brettw): Most of these should be removed and the caller should call + // the view directly. // Returns the actual window that is focused when this TabContents is shown. - virtual gfx::NativeView GetContentNativeView() = 0; + gfx::NativeView GetContentNativeView(); // Returns the NativeView associated with this TabContents. Outside of // automation in the context of the UI, this is required to be implemented. - virtual gfx::NativeView GetNativeView() const = 0; + gfx::NativeView GetNativeView() const; // Returns the bounds of this TabContents in the screen coordinate system. - virtual void GetContainerBounds(gfx::Rect *out) const = 0; + void GetContainerBounds(gfx::Rect *out) const; // Make the tab the focused window. - virtual void Focus() = 0; + void Focus(); // Invoked the first time this tab is getting the focus through TAB traversal. // By default this does nothing, but is overridden to set the focus for the @@ -370,7 +376,12 @@ class TabContents : public PageNavigator, // // See also SetInitialFocus(no arg). // FIXME(brettw) having two SetInitialFocus that do different things is silly. - virtual void SetInitialFocus(bool reverse) = 0; + void SetInitialFocus(bool reverse); + + // Returns true if the location bar should be focused by default rather than + // the page contents. The view will call this function when the tab is + // to see what it should do. + bool FocusLocationBarByDefault(); // Infobars ------------------------------------------------------------------ @@ -389,10 +400,10 @@ class TabContents : public PageNavigator, // Toolbars and such --------------------------------------------------------- // Returns whether the bookmark bar should be visible. - virtual bool IsBookmarkBarAlwaysVisible() = 0; + virtual bool IsBookmarkBarAlwaysVisible(); // Whether or not the shelf view is visible. - virtual void SetDownloadShelfVisible(bool visible) = 0; + virtual void SetDownloadShelfVisible(bool visible); bool IsDownloadShelfVisible() { return shelf_visible_; } // Notify our delegate that some of our content has animated. @@ -534,11 +545,15 @@ class TabContents : public PageNavigator, TabContents(Profile* profile); + RenderWidgetHostView* render_widget_host_view() const { + return render_manager_.current_view(); + } + // Changes the IsLoading state and notifies delegate as needed // |details| is used to provide details on the load that just finished // (but can be null if not applicable). Can be overridden. - virtual void SetIsLoading(bool is_loading, - LoadNotificationDetails* details) = 0; + void SetIsLoading(bool is_loading, + LoadNotificationDetails* details); // Called by a derived class when the TabContents is resized, causing // suppressed constrained web popups to be repositioned to the new bounds @@ -572,6 +587,11 @@ class TabContents : public PageNavigator, void OnGearsCreateShortcutDone(const GearsShortcutData2& shortcut_data, bool success); + + // Returns the DOMUI for the current state of the tab. This will either be + // the pending DOMUI, the committed DOMUI, or NULL. + DOMUI* GetDOMUIForCurrentState(); + // Data for core operation --------------------------------------------------- // Delegate for notifying our owner about stuff. Not owned by us. diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc index 6d8fe3e..da8669b 100644 --- a/chrome/browser/tab_contents/web_contents.cc +++ b/chrome/browser/tab_contents/web_contents.cc @@ -317,292 +317,6 @@ void WebContents::RegisterUserPrefs(PrefService* prefs) { IDS_STATIC_ENCODING_LIST); } -const string16& WebContents::GetTitle() const { - DOMUI* our_dom_ui = render_manager_.pending_dom_ui() ? - render_manager_.pending_dom_ui() : render_manager_.dom_ui(); - if (our_dom_ui) { - // Don't override the title in view source mode. - NavigationEntry* entry = controller_.GetActiveEntry(); - if (!(entry && entry->IsViewSourceMode())) { - // Give the DOM UI the chance to override our title. - const string16& title = our_dom_ui->overridden_title(); - if (!title.empty()) - return title; - } - } - - // We use the title for the last committed entry rather than a pending - // navigation entry. For example, when the user types in a URL, we want to - // keep the old page's title until the new load has committed and we get a new - // title. - // The exception is with transient pages, for which we really want to use - // their title, as they are not committed. - NavigationEntry* entry = controller_.GetTransientEntry(); - if (entry) - return entry->GetTitleForDisplay(&controller_); - - entry = controller_.GetLastCommittedEntry(); - if (entry) - return entry->GetTitleForDisplay(&controller_); - else if (controller_.LoadingURLLazily()) - return controller_.GetLazyTitle(); - return EmptyString16(); -} - -SiteInstance* WebContents::GetSiteInstance() const { - return render_manager_.current_host()->site_instance(); -} - -bool WebContents::ShouldDisplayURL() { - // Don't hide the url in view source mode. - NavigationEntry* entry = controller_.GetActiveEntry(); - if (entry && entry->IsViewSourceMode()) - return true; - DOMUI* dom_ui = GetDOMUIForCurrentState(); - if (dom_ui) - return !dom_ui->should_hide_url(); - return true; -} - -bool WebContents::ShouldDisplayFavIcon() { - // Always display a throbber during pending loads. - if (controller_.GetLastCommittedEntry() && controller_.pending_entry()) - return true; - - DOMUI* dom_ui = GetDOMUIForCurrentState(); - if (dom_ui) - return !dom_ui->hide_favicon(); - return true; -} - -std::wstring WebContents::GetStatusText() const { - if (!is_loading() || load_state_ == net::LOAD_STATE_IDLE) - return std::wstring(); - - switch (load_state_) { - case net::LOAD_STATE_WAITING_FOR_CACHE: - return l10n_util::GetString(IDS_LOAD_STATE_WAITING_FOR_CACHE); - case net::LOAD_STATE_RESOLVING_PROXY_FOR_URL: - return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_PROXY_FOR_URL); - case net::LOAD_STATE_RESOLVING_HOST: - return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_HOST); - case net::LOAD_STATE_CONNECTING: - return l10n_util::GetString(IDS_LOAD_STATE_CONNECTING); - case net::LOAD_STATE_SENDING_REQUEST: - return l10n_util::GetString(IDS_LOAD_STATE_SENDING_REQUEST); - case net::LOAD_STATE_WAITING_FOR_RESPONSE: - return l10n_util::GetStringF(IDS_LOAD_STATE_WAITING_FOR_RESPONSE, - load_state_host_); - // Ignore net::LOAD_STATE_READING_RESPONSE and net::LOAD_STATE_IDLE - case net::LOAD_STATE_IDLE: - case net::LOAD_STATE_READING_RESPONSE: - break; - } - - return std::wstring(); -} - -bool WebContents::NavigateToPendingEntry(bool reload) { - const NavigationEntry& entry = *controller_.pending_entry(); - - RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry); - if (!dest_render_view_host) - return false; // Unable to create the desired render view host. - - // Tell DevTools agent that it is attached prior to the navigation. - DevToolsManager* dev_tools_manager = g_browser_process->devtools_manager(); - if (dev_tools_manager) // NULL in unit tests. - dev_tools_manager->SendAttachToAgent(*this, dest_render_view_host); - - // Used for page load time metrics. - current_load_start_ = TimeTicks::Now(); - - // Navigate in the desired RenderViewHost. - dest_render_view_host->NavigateToEntry(entry, reload); - - if (entry.page_id() == -1) { - // HACK!! This code suppresses javascript: URLs from being added to - // session history, which is what we want to do for javascript: URLs that - // do not generate content. What we really need is a message from the - // renderer telling us that a new page was not created. The same message - // could be used for mailto: URLs and the like. - if (entry.url().SchemeIs(chrome::kJavaScriptScheme)) - return false; - } - - // Clear any provisional password saves - this stops password infobars - // showing up on pages the user navigates to while the right page is - // loading. - GetPasswordManager()->ClearProvisionalSave(); - - if (reload && !profile()->IsOffTheRecord()) { - HistoryService* history = - profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); - if (history) - history->SetFavIconOutOfDateForPage(entry.url()); - } - - return true; -} - -void WebContents::Stop() { - render_manager_.Stop(); - printing_.Stop(); -} - -void WebContents::Cut() { - render_view_host()->Cut(); -} - -void WebContents::Copy() { - render_view_host()->Copy(); -} - -void WebContents::Paste() { - render_view_host()->Paste(); -} - -void WebContents::DisassociateFromPopupCount() { - render_view_host()->DisassociateFromPopupCount(); -} - -TabContents* WebContents::Clone() { - // We create a new SiteInstance so that the new tab won't share processes - // with the old one. This can be changed in the future if we need it to share - // processes for some reason. - TabContents* tc = new WebContents(profile(), - SiteInstance::CreateSiteInstance(profile()), - MSG_ROUTING_NONE, NULL); - tc->controller().CopyStateFrom(controller_); - return tc; -} - -void WebContents::DidBecomeSelected() { - controller_.SetActive(true); - - if (render_widget_host_view()) - render_widget_host_view()->DidBecomeSelected(); - - // If pid() is -1, that means the RenderProcessHost still hasn't been - // initialized. It'll register with CacheManagerHost when it is. - if (process()->pid() != -1) - WebCacheManager::GetInstance()->ObserveActivity(process()->pid()); -} - -void WebContents::WasHidden() { - if (!capturing_contents()) { - // |render_view_host()| can be NULL if the user middle clicks a link to open - // a tab in then background, then closes the tab before selecting it. This - // is because closing the tab calls WebContents::Destroy(), which removes - // the |render_view_host()|; then when we actually destroy the window, - // OnWindowPosChanged() notices and calls HideContents() (which calls us). - if (render_widget_host_view()) - render_widget_host_view()->WasHidden(); - - // Loop through children and send WasHidden to them, too. - int count = static_cast<int>(child_windows_.size()); - for (int i = count - 1; i >= 0; --i) { - ConstrainedWindow* window = child_windows_.at(i); - window->WasHidden(); - } - } - - NotificationService::current()->Notify( - NotificationType::TAB_CONTENTS_HIDDEN, - Source<TabContents>(this), - NotificationService::NoDetails()); -} - -void WebContents::ShowContents() { - if (render_widget_host_view()) - render_widget_host_view()->DidBecomeSelected(); - - // Loop through children and send DidBecomeSelected to them, too. - int count = static_cast<int>(child_windows_.size()); - for (int i = count - 1; i >= 0; --i) { - ConstrainedWindow* window = child_windows_.at(i); - window->DidBecomeSelected(); - } -} - -void WebContents::HideContents() { - // TODO(pkasting): http://b/1239839 Right now we purposefully don't call - // our superclass HideContents(), because some callers want to be very picky - // about the order in which these get called. In addition to making the code - // here practically impossible to understand, this also means we end up - // calling TabContents::WasHidden() twice if callers call both versions of - // HideContents() on a WebContents. - WasHidden(); -} - -bool WebContents::IsBookmarkBarAlwaysVisible() { - // See GetDOMUIForCurrentState() comment for more info. This case is very - // similar, but for non-first loads, we want to use the committed entry. This - // is so the bookmarks bar disappears at the same time the page does. - if (controller_.GetLastCommittedEntry()) { - // Not the first load, always use the committed DOM UI. - if (render_manager_.dom_ui()) - return render_manager_.dom_ui()->force_bookmark_bar_visible(); - return false; // Default. - } - - // When it's the first load, we know either the pending one or the committed - // one will have the DOM UI in it (see GetDOMUIForCurrentState), and only one - // of them will be valid, so we can just check both. - if (render_manager_.pending_dom_ui()) - return render_manager_.pending_dom_ui()->force_bookmark_bar_visible(); - if (render_manager_.dom_ui()) - return render_manager_.dom_ui()->force_bookmark_bar_visible(); - return false; // Default. -} - -void WebContents::SetDownloadShelfVisible(bool visible) { - if (shelf_visible_ != visible) { - if (visible) { - // Invoke GetDownloadShelf to force the shelf to be created. - GetDownloadShelf(); - } - shelf_visible_ = visible; - - if (delegate_) - delegate_->ContentsStateChanged(this); - } - - // SetShelfVisible can force-close the shelf, so make sure we lay out - // everything correctly, as if the animation had finished. This doesn't - // matter for showing the shelf, as the show animation will do it. - ToolbarSizeChanged(false); - - if (visible) { - // Always set this value as it reflects the last time the download shelf - // was made visible (even if it was already visible). - last_download_shelf_show_ = TimeTicks::Now(); - } -} - -void WebContents::PopupNotificationVisibilityChanged(bool visible) { - render_view_host()->PopupNotificationVisibilityChanged(visible); -} - -bool WebContents::FocusLocationBarByDefault() { - DOMUI* dom_ui = GetDOMUIForCurrentState(); - if (dom_ui) - return dom_ui->focus_location_bar_by_default(); - return false; -} - -gfx::NativeView WebContents::GetNativeView() const { - return view_->GetNativeView(); -} - -gfx::NativeView WebContents::GetContentNativeView() { - return view_->GetContentNativeView(); -} - -void WebContents::GetContainerBounds(gfx::Rect *out) const { - view_->GetContainerBounds(out); -} - void WebContents::CreateShortcut() { NavigationEntry* entry = controller_.GetLastCommittedEntry(); if (!entry) @@ -688,44 +402,6 @@ bool WebContents::IsActiveEntry(int32 page_id) { active_entry->page_id() == page_id); } -void WebContents::Focus() { - view_->Focus(); -} - -void WebContents::SetInitialFocus(bool reverse) { - render_view_host()->SetInitialFocus(reverse); -} - -// Notifies the RenderWidgetHost instance about the fact that the page is -// loading, or done loading and calls the base implementation. -void WebContents::SetIsLoading(bool is_loading, - LoadNotificationDetails* details) { - if (is_loading == is_loading_) - return; - - if (!is_loading) { - load_state_ = net::LOAD_STATE_IDLE; - load_state_host_.clear(); - } - - render_manager_.SetIsLoading(is_loading); - - is_loading_ = is_loading; - waiting_for_response_ = is_loading; - - if (delegate_) - delegate_->LoadingStateChanged(this); - - NotificationType type = is_loading ? NotificationType::LOAD_START : - NotificationType::LOAD_STOP; - NotificationDetails det = NotificationService::NoDetails();; - if (details) - det = Details<LoadNotificationDetails>(details); - NotificationService::current()->Notify(type, - Source<NavigationController>(&controller_), - det); -} - RenderViewHostDelegate::View* WebContents::GetViewDelegate() const { return view_.get(); } @@ -1879,43 +1555,3 @@ void WebContents::GenerateKeywordIfNecessary( new_url->set_safe_for_autoreplace(true); url_model->Add(new_url); } - -DOMUI* WebContents::GetDOMUIForCurrentState() { - // When there is a pending navigation entry, we want to use the pending DOMUI - // that goes along with it to control the basic flags. For example, we want to - // show the pending URL in the URL bar, so we want the display_url flag to - // be from the pending entry. - // - // The confusion comes because there are multiple possibilities for the - // initial load in a tab as a side effect of the way the RenderViewHostManager - // works. - // - // - For the very first tab the load looks "normal". The new tab DOM UI is - // the pending one, and we want it to apply here. - // - // - For subsequent new tabs, they'll get a new SiteInstance which will then - // get switched to the one previously associated with the new tab pages. - // This switching will cause the manager to commit the RVH/DOMUI. So we'll - // have a committed DOM UI in this case. - // - // This condition handles all of these cases: - // - // - First load in first tab: no committed nav entry + pending nav entry + - // pending dom ui: - // -> Use pending DOM UI if any. - // - // - First load in second tab: no committed nav entry + pending nav entry + - // no pending DOM UI: - // -> Use the committed DOM UI if any. - // - // - Second navigation in any tab: committed nav entry + pending nav entry: - // -> Use pending DOM UI if any. - // - // - Normal state with no load: committed nav entry + no pending nav entry: - // -> Use committed DOM UI. - if (controller_.pending_entry() && - (controller_.GetLastCommittedEntry() || - render_manager_.pending_dom_ui())) - return render_manager_.pending_dom_ui(); - return render_manager_.dom_ui(); -} diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h index dc239ad..b798bd3 100644 --- a/chrome/browser/tab_contents/web_contents.h +++ b/chrome/browser/tab_contents/web_contents.h @@ -25,41 +25,9 @@ class WebContents : public TabContents { // Window stuff -------------------------------------------------------------- - // Returns true if the location bar should be focused by default rather than - // the page contents. The view will call this function when the tab is - // to see what it should do. - bool FocusLocationBarByDefault(); - // TabContents (public overrides) -------------------------------------------- virtual WebContents* AsWebContents() { return this; } - const string16& GetTitle() const; - virtual SiteInstance* GetSiteInstance() const; - virtual bool ShouldDisplayURL(); - virtual bool ShouldDisplayFavIcon(); - virtual std::wstring GetStatusText() const; - virtual bool NavigateToPendingEntry(bool reload); - virtual void Stop(); - virtual void Cut(); - virtual void Copy(); - virtual void Paste(); - virtual void DisassociateFromPopupCount(); - virtual TabContents* Clone(); - virtual void DidBecomeSelected(); - virtual void WasHidden(); - virtual void ShowContents(); - virtual void HideContents(); - virtual bool IsBookmarkBarAlwaysVisible(); - virtual void SetDownloadShelfVisible(bool visible); - virtual void PopupNotificationVisibilityChanged(bool visible); - virtual void Focus(); - - // Retarded pass-throughs to the view. - // TODO(brettw) fix this, tab contents shouldn't have these methods, probably - // it should be killed altogether. - virtual gfx::NativeView GetNativeView() const; - virtual gfx::NativeView GetContentNativeView(); - virtual void GetContainerBounds(gfx::Rect *out) const; // Web apps ------------------------------------------------------------------ @@ -129,14 +97,6 @@ class WebContents : public TabContents { } protected: - RenderWidgetHostView* render_widget_host_view() const { - return render_manager_.current_view(); - } - - // TabContents (private overrides) ------------------------------------------- - - virtual void SetInitialFocus(bool reverse); - virtual void SetIsLoading(bool is_loading, LoadNotificationDetails* details); // RenderViewHostDelegate ---------------------------------------------------- @@ -393,10 +353,6 @@ class WebContents : public TabContents { void GenerateKeywordIfNecessary( const ViewHostMsg_FrameNavigate_Params& params); - // Returns the DOMUI for the current state of the tab. This will either be - // the pending DOMUI, the committed DOMUI, or NULL. - DOMUI* GetDOMUIForCurrentState(); - DISALLOW_COPY_AND_ASSIGN(WebContents); }; |