diff options
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/web_contents.cc | 51 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.h | 27 |
2 files changed, 3 insertions, 75 deletions
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc index 589c0cb..039ddc2 100644 --- a/chrome/browser/tab_contents/web_contents.cc +++ b/chrome/browser/tab_contents/web_contents.cc @@ -17,6 +17,7 @@ #include "chrome/browser/dom_operation_notification_details.h" #include "chrome/browser/download/download_manager.h" #include "chrome/browser/download/download_request_manager.h" +#include "chrome/browser/gears_integration.h" #include "chrome/browser/google_util.h" #include "chrome/browser/js_before_unload_handler.h" #include "chrome/browser/jsmessage_box_handler.h" @@ -215,8 +216,6 @@ WebContents::WebContents(Profile* profile, } WebContents::~WebContents() { - if (web_app_.get()) - web_app_->RemoveObserver(this); if (pending_install_.callback_functor) pending_install_.callback_functor->Cancel(); NotificationService::current()->RemoveObserver( @@ -329,15 +328,6 @@ SiteInstance* WebContents::GetSiteInstance() const { return render_manager_.current_host()->site_instance(); } -SkBitmap WebContents::GetFavIcon() { - if (web_app_.get() && IsWebApplicationActive()) { - SkBitmap app_icon = web_app_->GetFavIcon(); - if (!app_icon.isNull()) - return app_icon; - } - return TabContents::GetFavIcon(); -} - std::wstring WebContents::GetStatusText() const { if (!is_loading() || load_state_ == net::LOAD_STATE_IDLE) return std::wstring(); @@ -499,23 +489,6 @@ void WebContents::GetContainerBounds(gfx::Rect *out) const { view_->GetContainerBounds(out); } -void WebContents::SetWebApp(WebApp* web_app) { - if (web_app_.get()) { - web_app_->RemoveObserver(this); - web_app_->SetWebContents(NULL); - } - - web_app_ = web_app; - if (web_app) { - web_app->AddObserver(this); - web_app_->SetWebContents(this); - } -} - -bool WebContents::IsWebApplication() const { - return (web_app_.get() != NULL); -} - void WebContents::CreateShortcut() { NavigationEntry* entry = controller()->GetLastCommittedEntry(); if (!entry) @@ -941,8 +914,6 @@ void WebContents::DidDownloadImage( fav_icon_helper_.FavIconDownloadFailed(id); else fav_icon_helper_.SetFavIcon(id, image_url, image); - if (web_app_.get() && !errored) - web_app_->SetImage(image_url, image); } void WebContents::RequestOpenURL(const GURL& url, const GURL& referrer, @@ -1544,25 +1515,6 @@ void WebContents::UpdateWebPreferences() { render_view_host()->UpdateWebPreferences(GetWebkitPrefs()); } -bool WebContents::IsWebApplicationActive() const { - if (!web_app_.get()) - return false; - - // If we are inside an application, the application is always active. For - // example, this allows us to display the GMail icon even when we are bounced - // the login page. - if (delegate() && delegate()->IsApplication()) - return true; - - return (GetURL() == web_app_->url()); -} - -void WebContents::WebAppImagesChanged(WebApp* web_app) { - DCHECK(web_app == web_app_.get()); - if (delegate() && IsWebApplicationActive()) - delegate()->NavigationStateChanged(this, TabContents::INVALIDATE_FAVICON); -} - void WebContents::OnGearsCreateShortcutDone( const GearsShortcutData& shortcut_data, bool success) { NavigationEntry* current_entry = controller()->GetLastCommittedEntry(); @@ -1572,7 +1524,6 @@ void WebContents::OnGearsCreateShortcutDone( if (success && same_page) { // Only switch to app mode if the user chose to create a shortcut and // we're still on the same page that it corresponded to. - SetWebApp(new WebApp(profile(), shortcut_data)); if (delegate()) delegate()->ConvertContentsToApplication(this); } diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h index 55f1ee7..39bf2c6 100644 --- a/chrome/browser/tab_contents/web_contents.h +++ b/chrome/browser/tab_contents/web_contents.h @@ -12,7 +12,7 @@ #include "chrome/browser/tab_contents/render_view_host_manager.h" #include "chrome/browser/shell_dialogs.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/web_app.h" +#include "chrome/common/gears_api.h" class AutofillManager; class InterstitialPageDelegate; @@ -32,8 +32,7 @@ class WaitableEvent; class WebContents : public TabContents, public RenderViewHostDelegate, public RenderViewHostManager::Delegate, - public SelectFileDialog::Listener, - public WebApp::Observer { + public SelectFileDialog::Listener { public: // If instance is NULL, then creates a new process for this view. Otherwise // initialize with a process already created for a different WebContents. @@ -88,7 +87,6 @@ class WebContents : public TabContents, virtual void Destroy(); virtual WebContents* AsWebContents() { return this; } virtual SiteInstance* GetSiteInstance() const; - virtual SkBitmap GetFavIcon(); virtual std::wstring GetStatusText() const; virtual bool NavigateToPendingEntry(bool reload); virtual void Stop(); @@ -113,13 +111,6 @@ class WebContents : public TabContents, // Web apps ------------------------------------------------------------------ - // Sets the WebApp for this WebContents. - void SetWebApp(WebApp* web_app); - WebApp* web_app() { return web_app_.get(); } - - // Return whether this tab contents was created to contain an application. - bool IsWebApplication() const; - // Tell Gears to create a shortcut for the current page. void CreateShortcut(); @@ -431,17 +422,6 @@ class WebContents : public TabContents, // Send webkit specific settings to the renderer. void UpdateWebPreferences(); - // Return whether the optional web application is active for the current URL. - // Call this method to check if web app properties are in effect. - // - // Note: This method should be used for presentation but not security. The app - // is always active if the containing window is a web application. - bool IsWebApplicationActive() const; - - // WebApp::Observer method. Invoked when the set of images contained in the - // web app changes. Notifies the delegate our favicon has changed. - virtual void WebAppImagesChanged(WebApp* web_app); - // Called when the user dismisses the shortcut creation dialog. 'success' is // true if the shortcut was created. void OnGearsCreateShortcutDone(const GearsShortcutData& shortcut_data, @@ -566,9 +546,6 @@ class WebContents : public TabContents, net::LoadState load_state_; std::wstring load_state_host_; - // Non-null if we're displaying content for a web app. - scoped_refptr<WebApp> web_app_; - DISALLOW_COPY_AND_ASSIGN(WebContents); }; |