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

Side by Side Diff: chrome/browser/extensions/api/alarms/alarm_manager.cc

Issue 242613004: Replace NOTIFICATION_EXTENSION_LOADED to NOTIFICATION_EXTENSION_LOADED_DEPRECATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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 unified diff | Download patch
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/api/alarms/alarm_manager.h" 5 #include "chrome/browser/extensions/api/alarms/alarm_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 95
96 } // namespace 96 } // namespace
97 97
98 // AlarmManager 98 // AlarmManager
99 99
100 AlarmManager::AlarmManager(content::BrowserContext* context) 100 AlarmManager::AlarmManager(content::BrowserContext* context)
101 : profile_(Profile::FromBrowserContext(context)), 101 : profile_(Profile::FromBrowserContext(context)),
102 clock_(new base::DefaultClock()), 102 clock_(new base::DefaultClock()),
103 delegate_(new DefaultAlarmDelegate(context)) { 103 delegate_(new DefaultAlarmDelegate(context)) {
104 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 104 registrar_.Add(this,
105 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
105 content::Source<Profile>(profile_)); 106 content::Source<Profile>(profile_));
106 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, 107 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
107 content::Source<Profile>(profile_)); 108 content::Source<Profile>(profile_));
108 109
109 StateStore* storage = ExtensionSystem::Get(profile_)->state_store(); 110 StateStore* storage = ExtensionSystem::Get(profile_)->state_store();
110 if (storage) 111 if (storage)
111 storage->RegisterKey(kRegisteredAlarms); 112 storage->RegisterKey(kRegisteredAlarms);
112 } 113 }
113 114
114 AlarmManager::~AlarmManager() { 115 AlarmManager::~AlarmManager() {
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 action.Run(extension_id); 409 action.Run(extension_id);
409 else 410 else
410 it->second.push(action); 411 it->second.push(action);
411 } 412 }
412 413
413 void AlarmManager::Observe( 414 void AlarmManager::Observe(
414 int type, 415 int type,
415 const content::NotificationSource& source, 416 const content::NotificationSource& source,
416 const content::NotificationDetails& details) { 417 const content::NotificationDetails& details) {
417 switch (type) { 418 switch (type) {
418 case chrome::NOTIFICATION_EXTENSION_LOADED: { 419 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
419 const Extension* extension = 420 const Extension* extension =
420 content::Details<const Extension>(details).ptr(); 421 content::Details<const Extension>(details).ptr();
421 StateStore* storage = ExtensionSystem::Get(profile_)->state_store(); 422 StateStore* storage = ExtensionSystem::Get(profile_)->state_store();
422 if (storage) { 423 if (storage) {
423 ready_actions_.insert( 424 ready_actions_.insert(
424 ReadyMap::value_type(extension->id(), ReadyQueue())); 425 ReadyMap::value_type(extension->id(), ReadyQueue()));
425 storage->GetExtensionValue(extension->id(), kRegisteredAlarms, 426 storage->GetExtensionValue(extension->id(), kRegisteredAlarms,
426 base::Bind(&AlarmManager::ReadFromStorage, 427 base::Bind(&AlarmManager::ReadFromStorage,
427 AsWeakPtr(), extension->id())); 428 AsWeakPtr(), extension->id()));
428 } 429 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 if (create_info.period_in_minutes.get()) { 480 if (create_info.period_in_minutes.get()) {
480 js_alarm->period_in_minutes.reset( 481 js_alarm->period_in_minutes.reset(
481 new double(*create_info.period_in_minutes)); 482 new double(*create_info.period_in_minutes));
482 } 483 }
483 } 484 }
484 485
485 Alarm::~Alarm() { 486 Alarm::~Alarm() {
486 } 487 }
487 488
488 } // namespace extensions 489 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698