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

Unified Diff: chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc

Issue 11316292: Add app.window.setIcon (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ShellWindowUpdate -> ShellWindowIconUpdated Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
diff --git a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
index 46c1fa85363fd97dbb46754c6ad5690bf52e582d..47bb782054a54360d067e2c5811fe5225f14d99d 100644
--- a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
+++ b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
@@ -8,9 +8,11 @@
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/browser/ui/extensions/shell_window.h"
#include "chrome/common/extensions/api/app_current_window_internal.h"
+#include "chrome/common/extensions/api/app_window.h"
namespace SetBounds = extensions::api::app_current_window_internal::SetBounds;
using extensions::api::app_current_window_internal::Bounds;
+namespace SetIcon = extensions::api::app_current_window_internal::SetIcon;
namespace extensions {
@@ -105,4 +107,18 @@ bool AppCurrentWindowInternalSetBoundsFunction::RunWithWindow(
return true;
}
+bool AppCurrentWindowInternalSetIconFunction::RunWithWindow(
+ ShellWindow* window) {
+ scoped_ptr<SetIcon::Params> params(SetIcon::Params::Create(*args_));
+ CHECK(params.get());
+ // The |icon_url| parameter may be a blob url (e.g. an image fetched with an
+ // XMLHttpRequest) or a resource url.
+ GURL url(params->icon_url);
+ if (!url.is_valid())
+ url = GetExtension()->GetResourceURL(params->icon_url);
+
+ window->SetAppIconUrl(url);
+ return true;
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698