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

Side by Side Diff: chrome/browser/chromeos/extensions/install_limiter.cc

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromeos/extensions/install_limiter.h" 5 #include "chrome/browser/chromeos/extensions/install_limiter.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/threading/sequenced_worker_pool.h" 11 #include "base/threading/sequenced_worker_pool.h"
12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/chromeos/extensions/install_limiter_factory.h" 12 #include "chrome/browser/chromeos/extensions/install_limiter_factory.h"
14 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/notification_details.h" 14 #include "content/public/browser/notification_details.h"
16 #include "content/public/browser/notification_source.h" 15 #include "content/public/browser/notification_source.h"
16 #include "extensions/browser/notification_types.h"
17 17
18 using content::BrowserThread; 18 using content::BrowserThread;
19 19
20 namespace { 20 namespace {
21 21
22 int64 GetFileSizeOnBlockingPool(const base::FilePath& file) { 22 int64 GetFileSizeOnBlockingPool(const base::FilePath& file) {
23 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); 23 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
24 24
25 // Get file size. In case of error, sets 0 as file size to let the installer 25 // Get file size. In case of error, sets 0 as file size to let the installer
26 // run and fail. 26 // run and fail.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return; 110 return;
111 111
112 const DeferredInstall& deferred = deferred_installs_.front(); 112 const DeferredInstall& deferred = deferred_installs_.front();
113 RunInstall(deferred.installer, deferred.path); 113 RunInstall(deferred.installer, deferred.path);
114 deferred_installs_.pop(); 114 deferred_installs_.pop();
115 } 115 }
116 116
117 void InstallLimiter::RunInstall(const scoped_refptr<CrxInstaller>& installer, 117 void InstallLimiter::RunInstall(const scoped_refptr<CrxInstaller>& installer,
118 const base::FilePath& path) { 118 const base::FilePath& path) {
119 registrar_.Add(this, 119 registrar_.Add(this,
120 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 120 extensions::NOTIFICATION_CRX_INSTALLER_DONE,
121 content::Source<CrxInstaller>(installer.get())); 121 content::Source<CrxInstaller>(installer.get()));
122 122
123 installer->InstallCrx(path); 123 installer->InstallCrx(path);
124 running_installers_.insert(installer); 124 running_installers_.insert(installer);
125 } 125 }
126 126
127 void InstallLimiter::Observe(int type, 127 void InstallLimiter::Observe(int type,
128 const content::NotificationSource& source, 128 const content::NotificationSource& source,
129 const content::NotificationDetails& details) { 129 const content::NotificationDetails& details) {
130 DCHECK_EQ(chrome::NOTIFICATION_CRX_INSTALLER_DONE, type); 130 DCHECK_EQ(extensions::NOTIFICATION_CRX_INSTALLER_DONE, type);
131 131
132 registrar_.Remove(this, 132 registrar_.Remove(this, extensions::NOTIFICATION_CRX_INSTALLER_DONE, source);
133 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
134 source);
135 133
136 const scoped_refptr<CrxInstaller> installer = 134 const scoped_refptr<CrxInstaller> installer =
137 content::Source<extensions::CrxInstaller>(source).ptr(); 135 content::Source<extensions::CrxInstaller>(source).ptr();
138 running_installers_.erase(installer); 136 running_installers_.erase(installer);
139 CheckAndRunDeferrredInstalls(); 137 CheckAndRunDeferrredInstalls();
140 } 138 }
141 139
142 } // namespace extensions 140 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698