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

Side by Side Diff: chrome/browser/extensions/extension_action.cc

Issue 11547033: Implement declarativeContent API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_action.h" 5 #include "chrome/browser/extensions/extension_action.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // When showing a script badge for the first time on a web page, fade it in. 265 // When showing a script badge for the first time on a web page, fade it in.
266 // Other transitions happen instantly. 266 // Other transitions happen instantly.
267 if (old_appearance == INVISIBLE && tab_id != kDefaultTabId && 267 if (old_appearance == INVISIBLE && tab_id != kDefaultTabId &&
268 action_type_ == extensions::Extension::ActionInfo::TYPE_SCRIPT_BADGE) { 268 action_type_ == extensions::Extension::ActionInfo::TYPE_SCRIPT_BADGE) {
269 RunIconAnimation(tab_id); 269 RunIconAnimation(tab_id);
270 } 270 }
271 271
272 return true; 272 return true;
273 } 273 }
274 274
275 void ExtensionAction::SetDeclarativeAppearance(int tab_id, Appearance value) {
276 DCHECK_NE(tab_id, kDefaultTabId);
277 SetValue(&declarative_appearance_, tab_id, value);
278 }
279
280 void ExtensionAction::ClearDeclarativeAppearance(int tab_id) {
281 declarative_appearance_.erase(tab_id);
282 }
283
275 void ExtensionAction::ClearAllValuesForTab(int tab_id) { 284 void ExtensionAction::ClearAllValuesForTab(int tab_id) {
276 popup_url_.erase(tab_id); 285 popup_url_.erase(tab_id);
277 title_.erase(tab_id); 286 title_.erase(tab_id);
278 icon_.erase(tab_id); 287 icon_.erase(tab_id);
279 badge_text_.erase(tab_id); 288 badge_text_.erase(tab_id);
280 badge_text_color_.erase(tab_id); 289 badge_text_color_.erase(tab_id);
281 badge_background_color_.erase(tab_id); 290 badge_background_color_.erase(tab_id);
282 appearance_.erase(tab_id); 291 appearance_.erase(tab_id);
283 icon_animation_.erase(tab_id); 292 icon_animation_.erase(tab_id);
284 } 293 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 icon_animation->Start(); 384 icon_animation->Start();
376 // After the icon is finished fading in (plus some padding to handle random 385 // After the icon is finished fading in (plus some padding to handle random
377 // timer delays), destroy it. We use a delayed task so that the Animation is 386 // timer delays), destroy it. We use a delayed task so that the Animation is
378 // deleted even if it hasn't finished by the time the MessageLoop is 387 // deleted even if it hasn't finished by the time the MessageLoop is
379 // destroyed. 388 // destroyed.
380 MessageLoop::current()->PostDelayedTask( 389 MessageLoop::current()->PostDelayedTask(
381 FROM_HERE, 390 FROM_HERE,
382 base::Bind(&DestroyIconAnimation, base::Passed(icon_animation.Pass())), 391 base::Bind(&DestroyIconAnimation, base::Passed(icon_animation.Pass())),
383 base::TimeDelta::FromMilliseconds(kIconFadeInDurationMs * 2)); 392 base::TimeDelta::FromMilliseconds(kIconFadeInDurationMs * 2));
384 } 393 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698