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

Unified Diff: chrome/browser/extensions/extension_idle_api.cc

Issue 10071035: RefCounted types should not have public destructors, chrome/browser/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 8 years, 8 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
« no previous file with comments | « chrome/browser/extensions/extension_idle_api.h ('k') | chrome/browser/extensions/extension_info_map.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_idle_api.cc
diff --git a/chrome/browser/extensions/extension_idle_api.cc b/chrome/browser/extensions/extension_idle_api.cc
index 05080882587f099348727daf24d14fe7465c81e3..8df6ac84892dff692f8a462bf05c0b96435e92d1 100644
--- a/chrome/browser/extensions/extension_idle_api.cc
+++ b/chrome/browser/extensions/extension_idle_api.cc
@@ -133,21 +133,19 @@ int CheckThresholdBounds(int timeout) {
if (timeout > kMaxThreshold) return kMaxThreshold;
return timeout;
}
-}; // namespace
-void ExtensionIdleQueryStateFunction::IdleStateCallback(int threshold,
- IdleState state) {
- // If our state is not active, make sure we're running a polling task to check
- // for active state and report it when it changes to active.
- if (state != IDLE_STATE_ACTIVE) {
- ExtensionIdlePollingTask::CreateNewPollTask(threshold, state, profile_);
- }
-
- result_.reset(CreateIdleValue(state));
+}; // namespace
- ExtensionIdleCache::UpdateCache(threshold, state);
+void ExtensionIdleEventRouter::OnIdleStateChange(Profile* profile,
+ IdleState state) {
+ // Prepare the single argument of the current state.
+ ListValue args;
+ args.Append(CreateIdleValue(state));
+ std::string json_args;
+ base::JSONWriter::Write(&args, &json_args);
- SendResponse(true);
+ profile->GetExtensionEventRouter()->DispatchEventToRenderers(
+ keys::kOnStateChanged, json_args, profile, GURL());
}
bool ExtensionIdleQueryStateFunction::RunImpl() {
@@ -169,16 +167,19 @@ bool ExtensionIdleQueryStateFunction::RunImpl() {
return true;
}
-void ExtensionIdleEventRouter::OnIdleStateChange(Profile* profile,
- IdleState state) {
- // Prepare the single argument of the current state.
- ListValue args;
- args.Append(CreateIdleValue(state));
- std::string json_args;
- base::JSONWriter::Write(&args, &json_args);
+void ExtensionIdleQueryStateFunction::IdleStateCallback(int threshold,
+ IdleState state) {
+ // If our state is not active, make sure we're running a polling task to check
+ // for active state and report it when it changes to active.
+ if (state != IDLE_STATE_ACTIVE) {
+ ExtensionIdlePollingTask::CreateNewPollTask(threshold, state, profile_);
+ }
- profile->GetExtensionEventRouter()->DispatchEventToRenderers(
- keys::kOnStateChanged, json_args, profile, GURL());
+ result_.reset(CreateIdleValue(state));
+
+ ExtensionIdleCache::UpdateCache(threshold, state);
+
+ SendResponse(true);
}
ExtensionIdleCache::CacheData ExtensionIdleCache::cached_data =
@@ -188,6 +189,10 @@ IdleState ExtensionIdleCache::CalculateIdleState(int threshold) {
return CalculateState(threshold, base::Time::Now().ToDoubleT());
}
+void ExtensionIdleCache::UpdateCache(int threshold, IdleState state) {
+ Update(threshold, state, base::Time::Now().ToDoubleT());
+}
+
IdleState ExtensionIdleCache::CalculateState(int threshold, double now) {
if (threshold < kMinThreshold)
return IDLE_STATE_UNKNOWN;
@@ -221,10 +226,6 @@ IdleState ExtensionIdleCache::CalculateState(int threshold, double now) {
return IDLE_STATE_UNKNOWN;
}
-void ExtensionIdleCache::UpdateCache(int threshold, IdleState state) {
- Update(threshold, state, base::Time::Now().ToDoubleT());
-}
-
void ExtensionIdleCache::Update(int threshold, IdleState state, double now) {
if (threshold < kMinThreshold)
return;
« no previous file with comments | « chrome/browser/extensions/extension_idle_api.h ('k') | chrome/browser/extensions/extension_info_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698