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

Unified Diff: chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc

Issue 289013002: cros: Clean up screenlockPrivate plumbing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 months 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/screenlock_private/screenlock_private_api.cc
diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc
index 32b0b80ba4e8ac57bbf69dd503e433ac25f0bb4d..985bacbf56228dd40878b1d07555fa91345c5ba6 100644
--- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc
+++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc
@@ -97,17 +97,15 @@ bool ScreenlockPrivateShowMessageFunction::RunAsync() {
return true;
}
-static const int kMaxButtonIconSize = 40;
+ScreenlockPrivateShowCustomIconFunction::
+ ScreenlockPrivateShowCustomIconFunction() {}
-ScreenlockPrivateShowButtonFunction::
- ScreenlockPrivateShowButtonFunction() {}
+ScreenlockPrivateShowCustomIconFunction::
+ ~ScreenlockPrivateShowCustomIconFunction() {}
-ScreenlockPrivateShowButtonFunction::
- ~ScreenlockPrivateShowButtonFunction() {}
-
-bool ScreenlockPrivateShowButtonFunction::RunAsync() {
- scoped_ptr<screenlock::ShowButton::Params> params(
- screenlock::ShowButton::Params::Create(*args_));
+bool ScreenlockPrivateShowCustomIconFunction::RunAsync() {
+ scoped_ptr<screenlock::ShowCustomIcon::Params> params(
+ screenlock::ShowCustomIcon::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
ScreenlockBridge::LockHandler* locker =
ScreenlockBridge::Get()->lock_handler();
@@ -116,37 +114,41 @@ bool ScreenlockPrivateShowButtonFunction::RunAsync() {
SendResponse(false);
return true;
}
+
+ const int kMaxButtonIconSize = 40;
extensions::ImageLoader* loader = extensions::ImageLoader::Get(GetProfile());
loader->LoadImageAsync(
- GetExtension(), GetExtension()->GetResource(params->icon),
+ GetExtension(),
+ GetExtension()->GetResource(params->icon),
gfx::Size(kMaxButtonIconSize, kMaxButtonIconSize),
- base::Bind(&ScreenlockPrivateShowButtonFunction::OnImageLoaded, this));
+ base::Bind(&ScreenlockPrivateShowCustomIconFunction::OnImageLoaded,
+ this));
return true;
}
-void ScreenlockPrivateShowButtonFunction::OnImageLoaded(
+void ScreenlockPrivateShowCustomIconFunction::OnImageLoaded(
const gfx::Image& image) {
ScreenlockBridge::LockHandler* locker =
ScreenlockBridge::Get()->lock_handler();
- ScreenlockPrivateEventRouter* router =
- ScreenlockPrivateEventRouter::GetFactoryInstance()->Get(GetProfile());
- locker->ShowUserPodButton(
+ locker->ShowUserPodCustomIcon(
ScreenlockBridge::GetAuthenticatedUserEmail(GetProfile()),
- image,
- base::Bind(&ScreenlockPrivateEventRouter::OnButtonClicked,
- base::Unretained(router)));
+ image);
SendResponse(error_.empty());
}
-ScreenlockPrivateHideButtonFunction::ScreenlockPrivateHideButtonFunction() {}
+ScreenlockPrivateHideCustomIconFunction::
+ ScreenlockPrivateHideCustomIconFunction() {
+}
-ScreenlockPrivateHideButtonFunction::~ScreenlockPrivateHideButtonFunction() {}
+ScreenlockPrivateHideCustomIconFunction::
+ ~ScreenlockPrivateHideCustomIconFunction() {
+}
-bool ScreenlockPrivateHideButtonFunction::RunAsync() {
+bool ScreenlockPrivateHideCustomIconFunction::RunAsync() {
ScreenlockBridge::LockHandler* locker =
ScreenlockBridge::Get()->lock_handler();
if (locker) {
- locker->HideUserPodButton(
+ locker->HideUserPodCustomIcon(
ScreenlockBridge::GetAuthenticatedUserEmail(GetProfile()));
} else {
SetError(kNotLockedError);
@@ -268,10 +270,6 @@ void ScreenlockPrivateEventRouter::Shutdown() {
ScreenlockBridge::Get()->RemoveObserver(this);
}
-void ScreenlockPrivateEventRouter::OnButtonClicked() {
- DispatchEvent(screenlock::OnButtonClicked::kEventName, NULL);
-}
-
void ScreenlockPrivateEventRouter::OnAuthAttempted(
ScreenlockBridge::LockHandler::AuthType auth_type,
const std::string& value) {

Powered by Google App Engine
This is Rietveld 408576698