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

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: . Created 8 years, 1 month 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 659c8ac4b6f0aee2c581acf34c65e07e2952c574..0e499960adbbb6b9a4e8c141db2433f5d15b7b28 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
@@ -7,12 +7,14 @@
#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/ui/extensions/shell_window.h"
#include "chrome/common/extensions/api/app_current_window_internal.h"
-
-namespace SetBounds = extensions::api::app_current_window_internal::SetBounds;
-using extensions::api::app_current_window_internal::Bounds;
+#include "chrome/common/extensions/api/app_window.h"
namespace extensions {
+namespace SetBounds = api::app_current_window_internal::SetBounds;
+using api::app_current_window_internal::Bounds;
+namespace SetLauncherIcon = api::app_current_window_internal::SetLauncherIcon;
jeremya 2012/12/03 00:09:34 Why move these inside 'namespace extensions'?
stevenjb 2012/12/03 19:02:41 It seemed simpler since they all have extensions::
+
namespace {
const char kNoAssociatedShellWindow[] =
@@ -104,4 +106,19 @@ bool AppCurrentWindowInternalSetBoundsFunction::RunWithWindow(
return true;
}
+bool AppCurrentWindowInternalSetLauncherIconFunction::RunWithWindow(
+ ShellWindow* window) {
+ scoped_ptr<SetLauncherIcon::Params> params(
+ SetLauncherIcon::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->SetLauncherIconUrl(url);
+ return true;
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698