diff options
author | kcarattini <kcarattini@chromium.org> | 2015-05-05 16:57:42 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-05 23:58:34 +0000 |
commit | 103d4a1ba504adeea1cb9f0dd8faeb8dc4f9dedd (patch) | |
tree | 3d28003d66f72a5745080bcff91e032b72830745 /extensions/browser/app_window | |
parent | e852f8d50a4c65f0de6fcc3753abdc8ba3b22a9e (diff) | |
download | chromium_src-103d4a1ba504adeea1cb9f0dd8faeb8dc4f9dedd.zip chromium_src-103d4a1ba504adeea1cb9f0dd8faeb8dc4f9dedd.tar.gz chromium_src-103d4a1ba504adeea1cb9f0dd8faeb8dc4f9dedd.tar.bz2 |
Removes app badging code
BUG=311878
NOPRESUBMIT=true
Review URL: https://codereview.chromium.org/1122213002
Cr-Commit-Position: refs/heads/master@{#328440}
Diffstat (limited to 'extensions/browser/app_window')
-rw-r--r-- | extensions/browser/app_window/app_window.cc | 43 | ||||
-rw-r--r-- | extensions/browser/app_window/app_window.h | 21 | ||||
-rw-r--r-- | extensions/browser/app_window/native_app_window.h | 3 |
3 files changed, 2 insertions, 65 deletions
diff --git a/extensions/browser/app_window/app_window.cc b/extensions/browser/app_window/app_window.cc index 64fa3c3..c1959a9 100644 --- a/extensions/browser/app_window/app_window.cc +++ b/extensions/browser/app_window/app_window.cc @@ -514,10 +514,6 @@ base::string16 AppWindow::GetTitle() const { } void AppWindow::SetAppIconUrl(const GURL& url) { - // If the same url is being used for the badge, ignore it. - if (url == badge_icon_url_) - return; - // Avoid using any previous icons that were being downloaded. image_loader_ptr_factory_.InvalidateWeakPtrs(); @@ -534,29 +530,6 @@ void AppWindow::SetAppIconUrl(const GURL& url) { image_loader_ptr_factory_.GetWeakPtr())); } -void AppWindow::SetBadgeIconUrl(const GURL& url) { - // Avoid using any previous icons that were being downloaded. - image_loader_ptr_factory_.InvalidateWeakPtrs(); - - // Reset |app_icon_image_| to abort pending image load (if any). - badge_icon_image_.reset(); - - badge_icon_url_ = url; - web_contents()->DownloadImage( - url, - true, // is a favicon - 0, // no maximum size - false, // normal cache policy - base::Bind(&AppWindow::DidDownloadFavicon, - image_loader_ptr_factory_.GetWeakPtr())); -} - -void AppWindow::ClearBadge() { - badge_icon_image_.reset(); - badge_icon_url_ = GURL(); - UpdateBadgeIcon(gfx::Image()); -} - void AppWindow::UpdateShape(scoped_ptr<SkRegion> region) { native_app_window_->UpdateShape(region.Pass()); } @@ -766,21 +739,14 @@ void AppWindow::GetSerializedState(base::DictionaryValue* properties) const { //------------------------------------------------------------------------------ // Private methods -void AppWindow::UpdateBadgeIcon(const gfx::Image& image) { - badge_icon_ = image; - native_app_window_->UpdateBadgeIcon(); -} - void AppWindow::DidDownloadFavicon( int id, int http_status_code, const GURL& image_url, const std::vector<SkBitmap>& bitmaps, const std::vector<gfx::Size>& original_bitmap_sizes) { - if ((image_url != app_icon_url_ && image_url != badge_icon_url_) || - bitmaps.empty()) { + if (image_url != app_icon_url_ || bitmaps.empty()) return; - } // Bitmaps are ordered largest to smallest. Choose the smallest bitmap // whose height >= the preferred size. @@ -791,12 +757,7 @@ void AppWindow::DidDownloadFavicon( largest_index = i; } const SkBitmap& largest = bitmaps[largest_index]; - if (image_url == app_icon_url_) { - UpdateAppIcon(gfx::Image::CreateFrom1xBitmap(largest)); - return; - } - - UpdateBadgeIcon(gfx::Image::CreateFrom1xBitmap(largest)); + UpdateAppIcon(gfx::Image::CreateFrom1xBitmap(largest)); } void AppWindow::OnExtensionIconImageChanged(IconImage* image) { diff --git a/extensions/browser/app_window/app_window.h b/extensions/browser/app_window/app_window.h index 10baa0e..1112d38 100644 --- a/extensions/browser/app_window/app_window.h +++ b/extensions/browser/app_window/app_window.h @@ -222,8 +222,6 @@ class AppWindow : public content::WebContentsDelegate, content::BrowserContext* browser_context() const { return browser_context_; } const gfx::Image& app_icon() const { return app_icon_; } const GURL& app_icon_url() const { return app_icon_url_; } - const gfx::Image& badge_icon() const { return badge_icon_; } - const GURL& badge_icon_url() const { return badge_icon_url_; } const GURL& initial_url() const { return initial_url_; } bool is_hidden() const { return is_hidden_; } @@ -252,12 +250,6 @@ class AppWindow : public content::WebContentsDelegate, // Specifies a url for the launcher icon. void SetAppIconUrl(const GURL& icon_url); - // Specifies a url for the window badge. - void SetBadgeIconUrl(const GURL& icon_url); - - // Clear the current badge. - void ClearBadge(); - // Set the window shape. Passing a NULL |region| sets the default shape. void UpdateShape(scoped_ptr<SkRegion> region); @@ -470,10 +462,6 @@ class AppWindow : public content::WebContentsDelegate, web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() override; - // Updates the badge to |image|. Called internally from the image loader - // callback. - void UpdateBadgeIcon(const gfx::Image& image); - // Callback from web_contents()->DownloadFavicon. void DidDownloadFavicon(int id, int http_status_code, @@ -507,15 +495,6 @@ class AppWindow : public content::WebContentsDelegate, // An object to load the app's icon as an extension resource. scoped_ptr<IconImage> app_icon_image_; - // Badge for icon shown in the task bar. - gfx::Image badge_icon_; - - // URL to be used for setting the badge on the app icon. - GURL badge_icon_url_; - - // An object to load the badge as an extension resource. - scoped_ptr<IconImage> badge_icon_image_; - scoped_ptr<NativeAppWindow> native_app_window_; scoped_ptr<AppWindowContents> app_window_contents_; scoped_ptr<AppDelegate> app_delegate_; diff --git a/extensions/browser/app_window/native_app_window.h b/extensions/browser/app_window/native_app_window.h index 0bcb65d..fda44ed 100644 --- a/extensions/browser/app_window/native_app_window.h +++ b/extensions/browser/app_window/native_app_window.h @@ -40,9 +40,6 @@ class NativeAppWindow : public ui::BaseWindow, // Called when the title of the window changes. virtual void UpdateWindowTitle() = 0; - // Called to update the badge icon. - virtual void UpdateBadgeIcon() = 0; - // Called when the draggable regions are changed. virtual void UpdateDraggableRegions( const std::vector<DraggableRegion>& regions) = 0; |