diff options
32 files changed, 245 insertions, 228 deletions
diff --git a/chrome/browser/extensions/api/system_info/system_info_api.cc b/chrome/browser/extensions/api/system_info/system_info_api.cc index 465bc77..d203948 100644 --- a/chrome/browser/extensions/api/system_info/system_info_api.cc +++ b/chrome/browser/extensions/api/system_info/system_info_api.cc @@ -95,8 +95,8 @@ class SystemInfoEventRouter : public gfx::DisplayObserver, // The callbacks of querying storage info to start and stop watching the // storages. Called from UI thread. - void StartWatchingStorages(const StorageInfo& info, bool success); - void StopWatchingStorages(const StorageInfo& info, bool success); + void StartWatchingStorages(bool success); + void StopWatchingStorages(bool success); // Called to dispatch the systemInfo.display.onDisplayChanged event. void OnDisplayChanged(); @@ -127,26 +127,20 @@ SystemInfoEventRouter::~SystemInfoEventRouter() { storage_monitor->RemoveObserver(this); } -void SystemInfoEventRouter::StartWatchingStorages( - const StorageInfo& info, bool success) { +void SystemInfoEventRouter::StartWatchingStorages(bool success) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!success) return; - for (StorageInfo::const_iterator it = info.begin(); it != info.end(); ++it) { - StorageInfoProvider::Get()->StartWatching((*it)->id); - } + StorageInfoProvider::Get()->StartWatchingAllStorages(); } -void SystemInfoEventRouter::StopWatchingStorages( - const StorageInfo& info, bool success) { +void SystemInfoEventRouter::StopWatchingStorages(bool success) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!success) return; - for (StorageInfo::const_iterator it = info.begin(); it != info.end(); ++it) { - StorageInfoProvider::Get()->StopWatching((*it)->id); - } + StorageInfoProvider::Get()->StopWatchingAllStorages(); } void SystemInfoEventRouter::AddEventListener(const std::string& event_name) { diff --git a/chrome/browser/extensions/api/system_info/system_info_provider.h b/chrome/browser/extensions/api/system_info/system_info_provider.h index 1fc5b35..0215820 100644 --- a/chrome/browser/extensions/api/system_info/system_info_provider.h +++ b/chrome/browser/extensions/api/system_info/system_info_provider.h @@ -34,36 +34,57 @@ namespace extensions { // class is being guarded by SystemInfoProvider. // // |info_| is accessed on the UI thread while |is_waiting_for_completion_| is -// false and on the BlockingPool under |worker_pool_token_| while -// |is_waiting_for_completion_| is true. +// false and on the sequenced worker pool while |is_waiting_for_completion_| is +// true. template<class T> class SystemInfoProvider : public base::RefCountedThreadSafe<SystemInfoProvider<T> > { public: - // Callback type for completing to get information. The callback accepts - // two arguments. The first one is the information got already, the second - // one indicates whether its contents are valid, for example, no error - // occurs in querying the information. - typedef base::Callback<void(const T&, bool)> QueryInfoCompletionCallback; + // Callback type for completing to get information. The argument indicates + // whether its contents are valid, for example, no error occurs in querying + // the information. + typedef base::Callback<void(bool)> QueryInfoCompletionCallback; typedef std::queue<QueryInfoCompletionCallback> CallbackQueue; SystemInfoProvider() : is_waiting_for_completion_(false) { - worker_pool_token_ = - content::BrowserThread::GetBlockingPool()->GetSequenceToken(); + base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); + worker_pool_ = pool->GetSequencedTaskRunnerWithShutdownBehavior( + pool->GetSequenceToken(), + base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); } virtual ~SystemInfoProvider() {} + // Override to do any prepare work on UI thread before |QueryInfo()| gets + // called. + virtual void PrepareQueryOnUIThread() {} + + // The parameter |do_query_info_callback| is query info task which is posts to + // SystemInfoProvider sequenced worker pool. + // + // You can do any initial things of *InfoProvider before start to query info. + // While overriding this method, |do_query_info_callback| *must* be called + // directly or indirectly. + // + // Sample usage please refer to StorageInfoProvider. + virtual void InitializeProvider(const base::Closure& do_query_info_callback) { + do_query_info_callback.Run(); + } + // For testing static void InitializeForTesting( scoped_refptr<SystemInfoProvider<T> > provider) { DCHECK(provider.get() != NULL); - single_shared_provider_.Get() = provider; + provider_.Get() = provider; } // Start to query the system information. Should be called on UI thread. // The |callback| will get called once the query is completed. + // + // If the parameter |callback| itself calls StartQueryInfo(callback2), + // callback2 will be called immediately rather than triggering another call to + // the system. void StartQueryInfo(const QueryInfoCompletionCallback& callback) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -75,46 +96,31 @@ class SystemInfoProvider is_waiting_for_completion_ = true; - StartQueryInfoImpl(); + InitializeProvider(base::Bind( + &SystemInfoProvider<T>::StartQueryInfoPostInitialization, this)); } protected: - // Default implementation of querying system information. - // - // While overriding, there are two things need to do: - // 1). Bind custom callback function for query system information. - // 2). Post the custom task to blocking pool. - virtual void StartQueryInfoImpl() { - base::Closure callback = - base::Bind(&SystemInfoProvider<T>::QueryOnWorkerPool, this); - PostQueryTaskToBlockingPool(FROM_HERE, callback); - } + // Query the system information synchronously and put the result into |info_|. + // Return true if no error occurs. + // Should be called in the blocking pool. + virtual bool QueryInfo() = 0; - // Post a task to blocking pool for information querying. - // - // The parameter query_callback should invoke QueryInfo directly or indirectly - // to query the system information and return to UI thread when the query is - // completed. - void PostQueryTaskToBlockingPool(const tracked_objects::Location& from_here, - const base::Closure& query_callback) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - base::SequencedWorkerPool* worker_pool = - content::BrowserThread::GetBlockingPool(); - // The query task posted to the worker pool won't block shutdown, and any - // running query task at shutdown time will be ignored. - worker_pool->PostSequencedWorkerTaskWithShutdownBehavior( - worker_pool_token_, from_here, query_callback, - base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); + // Template function for creating the single shared provider instance. + // Template paramter I is the type of SystemInfoProvider implementation. + template<class I> + static I* GetInstance() { + if (!provider_.Get().get()) + provider_.Get() = new I(); + return static_cast<I*>(provider_.Get().get()); } - // Query the system information synchronously and output the result to the - // |info| parameter. The |info| contents MUST be reset firstly in its - // platform specific implementation. Return true if it succeeds, otherwise - // false is returned. - // TODO(Haojian): Remove the parameter T-typed pointer, replacing with void - // QueryInfo(). - virtual bool QueryInfo(T* info) = 0; + // The latest information filled up by QueryInfo implementation. Here we + // assume the T is disallowed to copy constructor, aligns with the structure + // type generated by IDL parser. + T info_; + private: // Called on UI thread. The |success| parameter means whether it succeeds // to get the information. void OnQueryCompleted(bool success) { @@ -122,39 +128,27 @@ class SystemInfoProvider while (!callbacks_.empty()) { QueryInfoCompletionCallback callback = callbacks_.front(); - callback.Run(info_, success); + callback.Run(success); callbacks_.pop(); } is_waiting_for_completion_ = false; } - // Template function for creating the single shared provider instance. - // Template paramter I is the type of SystemInfoProvider implementation. - template<class I> - static I* GetInstance() { - if (!single_shared_provider_.Get().get()) - single_shared_provider_.Get() = new I(); - return static_cast<I*>(single_shared_provider_.Get().get()); - } - - // The latest information filled up by QueryInfo implementation. Here we - // assume the T is disallowed to copy constructor, aligns with the structure - // type generated by IDL parser. - T info_; - - private: - // TODO(Haojian): Use PostBlockingPoolTaskAndReply to avoid unnecessary - // trampolines trip. - void QueryOnWorkerPool() { - bool success = QueryInfo(&info_); - content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, - base::Bind(&SystemInfoProvider<T>::OnQueryCompleted, this, success)); + void StartQueryInfoPostInitialization() { + PrepareQueryOnUIThread(); + // Post the custom query info task to blocking pool for information querying + // and reply with OnQueryCompleted. + base::PostTaskAndReplyWithResult( + worker_pool_, + FROM_HERE, + base::Bind(&SystemInfoProvider<T>::QueryInfo, this), + base::Bind(&SystemInfoProvider<T>::OnQueryCompleted, this)); } // The single shared provider instance. We create it only when needed. static typename base::LazyInstance< - scoped_refptr<SystemInfoProvider<T> > > single_shared_provider_; + scoped_refptr<SystemInfoProvider<T> > > provider_; // The queue of callbacks waiting for the info querying completion. It is // maintained on the UI thread. @@ -163,18 +157,13 @@ class SystemInfoProvider // Indicates if it is waiting for the querying completion. bool is_waiting_for_completion_; - // Unqiue sequence token so that the operation of querying inforation can - // be executed in order. - base::SequencedWorkerPool::SequenceToken worker_pool_token_; + // Sequenced worker pool to make the operation of querying information get + // executed in order. + scoped_refptr<base::SequencedTaskRunner> worker_pool_; DISALLOW_COPY_AND_ASSIGN(SystemInfoProvider<T>); }; -// Static member intialization. -template<class T> -typename base::LazyInstance<scoped_refptr<SystemInfoProvider<T> > > - SystemInfoProvider<T>::single_shared_provider_ = LAZY_INSTANCE_INITIALIZER; - } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_SYSTEM_INFO_PROVIDER_H_ diff --git a/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.cc b/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.cc index edc56fe..9c83112 100644 --- a/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.cc +++ b/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.cc @@ -10,17 +10,23 @@ namespace extensions { using api::system_info_cpu::CpuInfo; +// Static member intialization. +template<> +base::LazyInstance<scoped_refptr<SystemInfoProvider<CpuInfo> > > + SystemInfoProvider<CpuInfo>::provider_ = LAZY_INSTANCE_INITIALIZER; + CpuInfoProvider::CpuInfoProvider() {} CpuInfoProvider::~CpuInfoProvider() {} -bool CpuInfoProvider::QueryInfo(CpuInfo* info) { - if (info == NULL) - return false; +const CpuInfo& CpuInfoProvider::cpu_info() const { + return info_; +} - info->num_of_processors = base::SysInfo::NumberOfProcessors(); - info->arch_name = base::SysInfo::OperatingSystemArchitecture(); - info->model_name = base::SysInfo::CPUModelName(); +bool CpuInfoProvider::QueryInfo() { + info_.num_of_processors = base::SysInfo::NumberOfProcessors(); + info_.arch_name = base::SysInfo::OperatingSystemArchitecture(); + info_.model_name = base::SysInfo::CPUModelName(); return true; } diff --git a/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.h b/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.h index df7d77c..ccad39b 100644 --- a/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.h +++ b/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.h @@ -16,12 +16,13 @@ class CpuInfoProvider : public SystemInfoProvider<api::system_info_cpu::CpuInfo> { public: // Overriden from SystemInfoProvider<CpuInfo>. - virtual bool QueryInfo( - api::system_info_cpu::CpuInfo* info) OVERRIDE; + virtual bool QueryInfo() OVERRIDE; // Return the single shared instance of CpuInfoProvider. static CpuInfoProvider* Get(); + const api::system_info_cpu::CpuInfo& cpu_info() const; + private: friend class SystemInfoProvider<api::system_info_cpu::CpuInfo>; friend class MockCpuInfoProviderImpl; diff --git a/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider_unittest.cc b/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider_unittest.cc index 8b8d630..05ac22f 100644 --- a/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider_unittest.cc +++ b/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider_unittest.cc @@ -28,7 +28,7 @@ const struct TestCpuInfo kTestingCpuInfoData = { class TestCpuInfoProvider : public CpuInfoProvider { public: TestCpuInfoProvider(); - virtual bool QueryInfo(CpuInfo* info) OVERRIDE; + virtual bool QueryInfo() OVERRIDE; private: virtual ~TestCpuInfoProvider(); @@ -38,12 +38,10 @@ TestCpuInfoProvider::TestCpuInfoProvider() {} TestCpuInfoProvider::~TestCpuInfoProvider() {} -bool TestCpuInfoProvider::QueryInfo(CpuInfo* info) { - if (info == NULL) - return false; - info->arch_name = kTestingCpuInfoData.arch_name; - info->model_name = kTestingCpuInfoData.model_name; - info->num_of_processors = kTestingCpuInfoData.num_of_processors; +bool TestCpuInfoProvider::QueryInfo() { + info_.arch_name = kTestingCpuInfoData.arch_name; + info_.model_name = kTestingCpuInfoData.model_name; + info_.num_of_processors = kTestingCpuInfoData.num_of_processors; return true; } @@ -59,11 +57,13 @@ CpuInfoProviderTest::CpuInfoProviderTest() {} TEST_F(CpuInfoProviderTest, QueryCpuInfo) { cpu_info_provider_ = new TestCpuInfoProvider(); - scoped_ptr<CpuInfo> cpu_info(new CpuInfo()); - EXPECT_TRUE(cpu_info_provider_->QueryInfo(cpu_info.get())); - EXPECT_EQ(kTestingCpuInfoData.arch_name, cpu_info->arch_name); - EXPECT_EQ(kTestingCpuInfoData.model_name, cpu_info->model_name); - EXPECT_EQ(kTestingCpuInfoData.num_of_processors, cpu_info->num_of_processors); + EXPECT_TRUE(cpu_info_provider_->QueryInfo()); + EXPECT_EQ(kTestingCpuInfoData.arch_name, + cpu_info_provider_->cpu_info().arch_name); + EXPECT_EQ(kTestingCpuInfoData.model_name, + cpu_info_provider_->cpu_info().model_name); + EXPECT_EQ(kTestingCpuInfoData.num_of_processors, + cpu_info_provider_->cpu_info().num_of_processors); } } diff --git a/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.cc b/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.cc index 34af82c..175bcdb 100644 --- a/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.cc +++ b/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.cc @@ -24,10 +24,9 @@ bool SystemInfoCpuGetFunction::RunImpl() { return true; } -void SystemInfoCpuGetFunction::OnGetCpuInfoCompleted(const CpuInfo& info, - bool success) { +void SystemInfoCpuGetFunction::OnGetCpuInfoCompleted(bool success) { if (success) - SetResult(info.ToValue().release()); + SetResult(CpuInfoProvider::Get()->cpu_info().ToValue().release()); else SetError("Error occurred when querying cpu information."); SendResponse(success); diff --git a/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.h b/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.h index 89ad54d..8a2fb52 100644 --- a/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.h +++ b/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.h @@ -17,8 +17,7 @@ class SystemInfoCpuGetFunction : public AsyncExtensionFunction { private: virtual ~SystemInfoCpuGetFunction(); virtual bool RunImpl() OVERRIDE; - void OnGetCpuInfoCompleted( - const api::system_info_cpu::CpuInfo& info, bool success); + void OnGetCpuInfoCompleted(bool success); }; } // namespace extensions diff --git a/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_apitest.cc b/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_apitest.cc index 149a60c..fcc27d0 100644 --- a/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_apitest.cc +++ b/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_apitest.cc @@ -17,13 +17,10 @@ class MockCpuInfoProviderImpl : public CpuInfoProvider { public: MockCpuInfoProviderImpl() {} - virtual bool QueryInfo(CpuInfo* info) OVERRIDE { - if (!info) return false; - - info->num_of_processors = 4; - info->arch_name = "x86"; - info->model_name = "unknown"; - + virtual bool QueryInfo() OVERRIDE { + info_.num_of_processors = 4; + info_.arch_name = "x86"; + info_.model_name = "unknown"; return true; } diff --git a/chrome/browser/extensions/api/system_info_display/display_info_provider.cc b/chrome/browser/extensions/api/system_info_display/display_info_provider.cc index fc3724a..9534ed3 100644 --- a/chrome/browser/extensions/api/system_info_display/display_info_provider.cc +++ b/chrome/browser/extensions/api/system_info_display/display_info_provider.cc @@ -6,6 +6,15 @@ namespace extensions { +// Static member intialization. +template<> +base::LazyInstance<scoped_refptr<SystemInfoProvider<DisplayInfo> > > + SystemInfoProvider<DisplayInfo>::provider_ = LAZY_INSTANCE_INITIALIZER; + +const DisplayInfo& DisplayInfoProvider::display_info() const { + return info_; +} + // static DisplayInfoProvider* DisplayInfoProvider::GetProvider() { return DisplayInfoProvider::GetInstance<DisplayInfoProvider>(); diff --git a/chrome/browser/extensions/api/system_info_display/display_info_provider.h b/chrome/browser/extensions/api/system_info_display/display_info_provider.h index 5820ff5..63a7077 100644 --- a/chrome/browser/extensions/api/system_info_display/display_info_provider.h +++ b/chrome/browser/extensions/api/system_info_display/display_info_provider.h @@ -17,7 +17,7 @@ typedef std::vector<linked_ptr< class DisplayInfoProvider : public SystemInfoProvider<DisplayInfo> { public: - typedef base::Callback<void(const DisplayInfo& info, bool success)> + typedef base::Callback<void(bool success)> RequestInfoCallback; typedef base::Callback<void(bool success, const std::string& error)> SetInfoCallback; @@ -42,10 +42,12 @@ class DisplayInfoProvider : public SystemInfoProvider<DisplayInfo> { const api::system_info_display::DisplayProperties& info, const SetInfoCallback& callback); + const DisplayInfo& display_info() const; + protected: // Overriden from SystemInfoProvider<DisplayInfo>. // The implementation is platform specific. - virtual bool QueryInfo(DisplayInfo* info) OVERRIDE; + virtual bool QueryInfo() OVERRIDE; friend class SystemInfoProvider<DisplayInfo>; diff --git a/chrome/browser/extensions/api/system_info_display/display_info_provider_chromeos.cc b/chrome/browser/extensions/api/system_info_display/display_info_provider_chromeos.cc index 7ce7621..e680bc2 100644 --- a/chrome/browser/extensions/api/system_info_display/display_info_provider_chromeos.cc +++ b/chrome/browser/extensions/api/system_info_display/display_info_provider_chromeos.cc @@ -411,12 +411,11 @@ bool SetInfoImpl(const std::string& display_id_str, } // namespace void DisplayInfoProvider::RequestInfo(const RequestInfoCallback& callback) { - DisplayInfo requested_info; - bool success = QueryInfo(&requested_info); + bool success = QueryInfo(); base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, requested_info, success)); + base::Bind(callback, success)); } void DisplayInfoProvider::SetInfo(const std::string& display_id, @@ -429,9 +428,8 @@ void DisplayInfoProvider::SetInfo(const std::string& display_id, base::Bind(callback, success, error)); } -bool DisplayInfoProvider::QueryInfo(DisplayInfo* info) { - DCHECK(info); - info->clear(); +bool DisplayInfoProvider::QueryInfo() { + info_.clear(); DisplayManager* display_manager = ash::Shell::GetInstance()->display_manager(); @@ -440,7 +438,7 @@ bool DisplayInfoProvider::QueryInfo(DisplayInfo* info) { int64 primary_id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { AddInfoForDisplay(*display_manager->GetDisplayAt(i), display_manager, - primary_id, info); + primary_id, &info_); } return true; diff --git a/chrome/browser/extensions/api/system_info_display/display_info_provider_chromeos_unittest.cc b/chrome/browser/extensions/api/system_info_display/display_info_provider_chromeos_unittest.cc index d9aaa6b..d157a26 100644 --- a/chrome/browser/extensions/api/system_info_display/display_info_provider_chromeos_unittest.cc +++ b/chrome/browser/extensions/api/system_info_display/display_info_provider_chromeos_unittest.cc @@ -17,11 +17,9 @@ namespace extensions { namespace { -void BindRequestDisplayInfoResult(DisplayInfo* target, - const DisplayInfo& result, - bool success) { +void BindRequestDisplayInfoResult(DisplayInfo* target, bool success) { ASSERT_TRUE(success); - *target = result; + *target = DisplayInfoProvider::GetProvider()->display_info(); } void BindSetDisplayUnitInfoResult(bool* success, diff --git a/chrome/browser/extensions/api/system_info_display/display_info_provider_mac.cc b/chrome/browser/extensions/api/system_info_display/display_info_provider_mac.cc index cdb986f..3ff9d6b 100644 --- a/chrome/browser/extensions/api/system_info_display/display_info_provider_mac.cc +++ b/chrome/browser/extensions/api/system_info_display/display_info_provider_mac.cc @@ -21,7 +21,7 @@ void DisplayInfoProvider::SetInfo( } // TODO(hongbo): implement display info querying on Mac OS X. -bool DisplayInfoProvider::QueryInfo(DisplayInfo* info) { +bool DisplayInfoProvider::QueryInfo() { return false; } diff --git a/chrome/browser/extensions/api/system_info_display/display_info_provider_unittest.cc b/chrome/browser/extensions/api/system_info_display/display_info_provider_unittest.cc index 46d5062..d0e2bd6 100644 --- a/chrome/browser/extensions/api/system_info_display/display_info_provider_unittest.cc +++ b/chrome/browser/extensions/api/system_info_display/display_info_provider_unittest.cc @@ -40,7 +40,7 @@ const struct TestDisplayInfo kTestingDisplayInfoData[] = { class TestDisplayInfoProvider : public DisplayInfoProvider { public: - virtual bool QueryInfo(DisplayInfo* info) OVERRIDE; + virtual bool QueryInfo() OVERRIDE; private: virtual ~TestDisplayInfoProvider(); @@ -48,10 +48,8 @@ class TestDisplayInfoProvider : public DisplayInfoProvider { TestDisplayInfoProvider::~TestDisplayInfoProvider() {} -bool TestDisplayInfoProvider::QueryInfo(DisplayInfo* info) { - if (info == NULL) - return false; - info->clear(); +bool TestDisplayInfoProvider::QueryInfo() { + info_.clear(); for (size_t i = 0; i < arraysize(kTestingDisplayInfoData); ++i) { linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo()); unit->id = kTestingDisplayInfoData[i].id; @@ -69,7 +67,7 @@ bool TestDisplayInfoProvider::QueryInfo(DisplayInfo* info) { unit->work_area.top = kTestingDisplayInfoData[i].work_area.top; unit->work_area.width = kTestingDisplayInfoData[i].work_area.width; unit->work_area.height = kTestingDisplayInfoData[i].work_area.height; - info->push_back(unit); + info_.push_back(unit); } return true; } @@ -87,12 +85,12 @@ DisplayInfoProviderTest::DisplayInfoProviderTest() } TEST_F(DisplayInfoProviderTest, QueryDisplayInfo) { - scoped_ptr<DisplayInfo> display_info(new DisplayInfo()); - EXPECT_TRUE(display_info_provider_->QueryInfo(display_info.get())); - EXPECT_EQ(arraysize(kTestingDisplayInfoData), display_info->size()); + EXPECT_TRUE(display_info_provider_->QueryInfo()); + const DisplayInfo& display_info = display_info_provider_->display_info(); + EXPECT_EQ(arraysize(kTestingDisplayInfoData), display_info.size()); for (size_t i = 0; i < arraysize(kTestingDisplayInfoData); ++i) { const linked_ptr<api::system_info_display::DisplayUnitInfo> unit = - (*display_info.get())[i]; + display_info[i]; EXPECT_EQ(kTestingDisplayInfoData[i].id, unit->id); EXPECT_EQ(kTestingDisplayInfoData[i].name, unit->name); EXPECT_DOUBLE_EQ(kTestingDisplayInfoData[i].dpi_x, unit->dpi_x); diff --git a/chrome/browser/extensions/api/system_info_display/display_info_provider_win.cc b/chrome/browser/extensions/api/system_info_display/display_info_provider_win.cc index 42acbc9..e242fbb 100644 --- a/chrome/browser/extensions/api/system_info_display/display_info_provider_win.cc +++ b/chrome/browser/extensions/api/system_info_display/display_info_provider_win.cc @@ -81,12 +81,11 @@ void DisplayInfoProvider::SetInfo( base::Bind(callback, false, "Not implemented")); } -bool DisplayInfoProvider::QueryInfo(DisplayInfo* info) { - DCHECK(info); - info->clear(); +bool DisplayInfoProvider::QueryInfo() { + info_.clear(); if (EnumDisplayMonitors(NULL, NULL, EnumMonitorCallback, - reinterpret_cast<LPARAM>(info))) + reinterpret_cast<LPARAM>(&info_))) return true; return false; } diff --git a/chrome/browser/extensions/api/system_info_display/display_info_provider_x11.cc b/chrome/browser/extensions/api/system_info_display/display_info_provider_x11.cc index 54c847a..a3f46d0 100644 --- a/chrome/browser/extensions/api/system_info_display/display_info_provider_x11.cc +++ b/chrome/browser/extensions/api/system_info_display/display_info_provider_x11.cc @@ -21,7 +21,7 @@ void DisplayInfoProvider::SetInfo( } // TODO(hongbo): implement X11 display info querying. -bool DisplayInfoProvider::QueryInfo(DisplayInfo* info) { +bool DisplayInfoProvider::QueryInfo() { return false; } diff --git a/chrome/browser/extensions/api/system_info_display/system_info_display_api.cc b/chrome/browser/extensions/api/system_info_display/system_info_display_api.cc index 2c20e67..d2c8748 100644 --- a/chrome/browser/extensions/api/system_info_display/system_info_display_api.cc +++ b/chrome/browser/extensions/api/system_info_display/system_info_display_api.cc @@ -22,9 +22,10 @@ bool SystemInfoDisplayGetDisplayInfoFunction::RunImpl() { } void SystemInfoDisplayGetDisplayInfoFunction::OnGetDisplayInfoCompleted( - const DisplayInfo& info, bool success) { + bool success) { if (success) { - results_ = api::system_info_display::GetDisplayInfo::Results::Create(info); + results_ = api::system_info_display::GetDisplayInfo::Results::Create( + DisplayInfoProvider::GetProvider()->display_info()); } else { SetError("Error occurred when querying display information."); } diff --git a/chrome/browser/extensions/api/system_info_display/system_info_display_api.h b/chrome/browser/extensions/api/system_info_display/system_info_display_api.h index 1a6e53c..db427e5 100644 --- a/chrome/browser/extensions/api/system_info_display/system_info_display_api.h +++ b/chrome/browser/extensions/api/system_info_display/system_info_display_api.h @@ -22,7 +22,7 @@ class SystemInfoDisplayGetDisplayInfoFunction : public AsyncExtensionFunction { virtual bool RunImpl() OVERRIDE; private: - void OnGetDisplayInfoCompleted(const DisplayInfo& info, bool success); + void OnGetDisplayInfoCompleted(bool success); }; class SystemInfoDisplaySetDisplayPropertiesFunction diff --git a/chrome/browser/extensions/api/system_info_display/system_info_display_apitest.cc b/chrome/browser/extensions/api/system_info_display/system_info_display_apitest.cc index 94637d3..ec254d7 100644 --- a/chrome/browser/extensions/api/system_info_display/system_info_display_apitest.cc +++ b/chrome/browser/extensions/api/system_info_display/system_info_display_apitest.cc @@ -20,8 +20,8 @@ class MockDisplayInfoProvider : public DisplayInfoProvider { public: MockDisplayInfoProvider() {} - virtual bool QueryInfo(DisplayInfo* info) OVERRIDE { - info->clear(); + virtual bool QueryInfo() OVERRIDE { + info_.clear(); for (int i = 0; i < 4; i++) { linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo()); unit->id = base::IntToString(i); @@ -48,7 +48,7 @@ class MockDisplayInfoProvider : public DisplayInfoProvider { unit->work_area.top = 0; unit->work_area.width = 960; unit->work_area.height = 720; - info->push_back(unit); + info_.push_back(unit); } return true; } diff --git a/chrome/browser/extensions/api/system_info_memory/memory_info_provider.cc b/chrome/browser/extensions/api/system_info_memory/memory_info_provider.cc index f1964be..4bef0ed 100644 --- a/chrome/browser/extensions/api/system_info_memory/memory_info_provider.cc +++ b/chrome/browser/extensions/api/system_info_memory/memory_info_provider.cc @@ -10,13 +10,22 @@ namespace extensions { using api::system_info_memory::MemoryInfo; +// Static member intialization. +template<> +base::LazyInstance<scoped_refptr<SystemInfoProvider<MemoryInfo> > > + SystemInfoProvider<MemoryInfo>::provider_ = LAZY_INSTANCE_INITIALIZER; + MemoryInfoProvider::MemoryInfoProvider() {} MemoryInfoProvider::~MemoryInfoProvider() {} -bool MemoryInfoProvider::QueryInfo(MemoryInfo* info) { - info->capacity = static_cast<double>(base::SysInfo::AmountOfPhysicalMemory()); - info->available_capacity = +const MemoryInfo& MemoryInfoProvider::memory_info() const { + return info_; +} + +bool MemoryInfoProvider::QueryInfo() { + info_.capacity = static_cast<double>(base::SysInfo::AmountOfPhysicalMemory()); + info_.available_capacity = static_cast<double>(base::SysInfo::AmountOfAvailablePhysicalMemory()); return true; } diff --git a/chrome/browser/extensions/api/system_info_memory/memory_info_provider.h b/chrome/browser/extensions/api/system_info_memory/memory_info_provider.h index 589d3ac..d920036 100644 --- a/chrome/browser/extensions/api/system_info_memory/memory_info_provider.h +++ b/chrome/browser/extensions/api/system_info_memory/memory_info_provider.h @@ -17,8 +17,9 @@ class MemoryInfoProvider static MemoryInfoProvider* Get(); // Overriden from SystemInfoProvider<MemoryInfo>. - virtual bool QueryInfo( - api::system_info_memory::MemoryInfo* info) OVERRIDE; + virtual bool QueryInfo() OVERRIDE; + + const api::system_info_memory::MemoryInfo& memory_info() const; private: friend class SystemInfoProvider< diff --git a/chrome/browser/extensions/api/system_info_memory/memory_info_provider_unittest.cc b/chrome/browser/extensions/api/system_info_memory/memory_info_provider_unittest.cc index 9e008b3..1f4aae4 100644 --- a/chrome/browser/extensions/api/system_info_memory/memory_info_provider_unittest.cc +++ b/chrome/browser/extensions/api/system_info_memory/memory_info_provider_unittest.cc @@ -20,18 +20,17 @@ const struct TestMemoryInfo kTestingMemoryInfoData = { 4096.0, 1024.0 }; class TestMemoryInfoProvider : public MemoryInfoProvider { public: - virtual bool QueryInfo(MemoryInfo* info) OVERRIDE; + virtual bool QueryInfo() OVERRIDE; + private: virtual ~TestMemoryInfoProvider(); }; TestMemoryInfoProvider::~TestMemoryInfoProvider() {} -bool TestMemoryInfoProvider::QueryInfo(MemoryInfo* info) { - if (info == NULL) - return false; - info->capacity = kTestingMemoryInfoData.capacity; - info->available_capacity = kTestingMemoryInfoData.available_capacity; +bool TestMemoryInfoProvider::QueryInfo() { + info_.capacity = kTestingMemoryInfoData.capacity; + info_.available_capacity = kTestingMemoryInfoData.available_capacity; return true; } @@ -48,11 +47,11 @@ MemoryInfoProviderTest::MemoryInfoProviderTest() } TEST_F(MemoryInfoProviderTest, QueryMemoryInfo) { - scoped_ptr<MemoryInfo> memory_info(new MemoryInfo()); - EXPECT_TRUE(memory_info_provider_->QueryInfo(memory_info.get())); - EXPECT_DOUBLE_EQ(kTestingMemoryInfoData.capacity, memory_info->capacity); + EXPECT_TRUE(memory_info_provider_->QueryInfo()); + EXPECT_DOUBLE_EQ(kTestingMemoryInfoData.capacity, + memory_info_provider_->memory_info().capacity); EXPECT_DOUBLE_EQ(kTestingMemoryInfoData.available_capacity, - memory_info->available_capacity); + memory_info_provider_->memory_info().available_capacity); } } // namespace extensions diff --git a/chrome/browser/extensions/api/system_info_memory/system_info_memory_api.cc b/chrome/browser/extensions/api/system_info_memory/system_info_memory_api.cc index 38bf680c..7439294 100644 --- a/chrome/browser/extensions/api/system_info_memory/system_info_memory_api.cc +++ b/chrome/browser/extensions/api/system_info_memory/system_info_memory_api.cc @@ -20,10 +20,9 @@ bool SystemInfoMemoryGetFunction::RunImpl() { return true; } -void SystemInfoMemoryGetFunction::OnGetMemoryInfoCompleted( - const MemoryInfo& info, bool success) { +void SystemInfoMemoryGetFunction::OnGetMemoryInfoCompleted(bool success) { if (success) - SetResult(info.ToValue().release()); + SetResult(MemoryInfoProvider::Get()->memory_info().ToValue().release()); else SetError("Error occurred when querying memory information."); SendResponse(success); diff --git a/chrome/browser/extensions/api/system_info_memory/system_info_memory_api.h b/chrome/browser/extensions/api/system_info_memory/system_info_memory_api.h index 3a157b8..410fbf6 100644 --- a/chrome/browser/extensions/api/system_info_memory/system_info_memory_api.h +++ b/chrome/browser/extensions/api/system_info_memory/system_info_memory_api.h @@ -18,9 +18,7 @@ class SystemInfoMemoryGetFunction : public AsyncExtensionFunction { private: virtual ~SystemInfoMemoryGetFunction(); virtual bool RunImpl() OVERRIDE; - void OnGetMemoryInfoCompleted( - const api::system_info_memory::MemoryInfo& info, - bool success); + void OnGetMemoryInfoCompleted(bool success); }; } // namespace extensions diff --git a/chrome/browser/extensions/api/system_info_memory/system_info_memory_apitest.cc b/chrome/browser/extensions/api/system_info_memory/system_info_memory_apitest.cc index a101640..8170b1f 100644 --- a/chrome/browser/extensions/api/system_info_memory/system_info_memory_apitest.cc +++ b/chrome/browser/extensions/api/system_info_memory/system_info_memory_apitest.cc @@ -20,9 +20,9 @@ class MockMemoryInfoProviderImpl : public MemoryInfoProvider { public: MockMemoryInfoProviderImpl() {} - virtual bool QueryInfo(MemoryInfo* info) OVERRIDE { - info->capacity = 4096; - info->available_capacity = 1024; + virtual bool QueryInfo() OVERRIDE { + info_.capacity = 4096; + info_.available_capacity = 1024; return true; } private: diff --git a/chrome/browser/extensions/api/system_info_storage/storage_info_provider.cc b/chrome/browser/extensions/api/system_info_storage/storage_info_provider.cc index 581e02f..c43fe8f 100644 --- a/chrome/browser/extensions/api/system_info_storage/storage_info_provider.cc +++ b/chrome/browser/extensions/api/system_info_storage/storage_info_provider.cc @@ -42,6 +42,12 @@ void BuildStorageUnitInfo(const chrome::StorageInfo& info, const int kDefaultPollingIntervalMs = 1000; const char kWatchingTokenName[] = "_storage_info_watching_token_"; +// Static member intialization. +template<> +base::LazyInstance<scoped_refptr<SystemInfoProvider<StorageUnitInfoList> > > + SystemInfoProvider<StorageUnitInfoList>::provider_ + = LAZY_INSTANCE_INITIALIZER; + StorageInfoProvider::StorageInfoProvider() : observers_(new ObserverListThreadSafe<StorageFreeSpaceObserver>()), watching_interval_(kDefaultPollingIntervalMs) { @@ -50,55 +56,50 @@ StorageInfoProvider::StorageInfoProvider() StorageInfoProvider::~StorageInfoProvider() { } -void StorageInfoProvider::StartQueryInfoImpl() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - // Register a callback to notify UI thread that StorageMonitor finishes the - // storage metadata retrieval on FILE thread. See the comments of - // StorageMonitor::Initialize about when the callback gets run. - StorageMonitor::GetInstance()->EnsureInitialized( - base::Bind(&StorageInfoProvider::QueryInfoImplOnUIThread, this)); +const StorageUnitInfoList& StorageInfoProvider::storage_unit_info_list() const { + return info_; +} + +void StorageInfoProvider::PrepareQueryOnUIThread() { + // Get all available storage devices before invoking |QueryInfo()| to get + // available capacity. + GetAllStoragesIntoInfoList(); } -void StorageInfoProvider::QueryInfoImplOnUIThread() { +void StorageInfoProvider::InitializeProvider( + const base::Closure& do_query_info_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - // At this point, we can call StorageMonitor::GetAllAvailableStorages to - // get the correct results. - QueryInfo(&info_); - // The amount of available capacity should be queried on blocking pool. - PostQueryTaskToBlockingPool(FROM_HERE, - base::Bind(&StorageInfoProvider::QueryAvailableCapacityOnBlockingPool, - this)); + // Register the |do_query_info_callback| callback to StorageMonitor. + // See the comments of StorageMonitor::EnsureInitialized about when the + // callback gets run. + StorageMonitor::GetInstance()->EnsureInitialized(do_query_info_callback); } -void StorageInfoProvider::QueryAvailableCapacityOnBlockingPool() { +bool StorageInfoProvider::QueryInfo() { DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); - for (StorageInfo::iterator it = info_.begin(); it != info_.end(); ++it) { + for (StorageUnitInfoList::iterator it = info_.begin(); + it != info_.end(); ++it) { int64 amount = GetStorageFreeSpaceFromTransientId((*it)->id); if (amount > 0) (*it)->available_capacity = static_cast<double>(amount); } - // Notify UI thread that the querying operation has completed. - BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, - base::Bind(&StorageInfoProvider::OnQueryCompleted, this, true)); + return true; } std::vector<chrome::StorageInfo> StorageInfoProvider::GetAllStorages() const { return StorageMonitor::GetInstance()->GetAllAvailableStorages(); } -bool StorageInfoProvider::QueryInfo(StorageInfo* info) { +void StorageInfoProvider::GetAllStoragesIntoInfoList() { + info_.clear(); std::vector<chrome::StorageInfo> storage_list = GetAllStorages(); - StorageInfo results; std::vector<chrome::StorageInfo>::const_iterator it = storage_list.begin(); for (; it != storage_list.end(); ++it) { linked_ptr<StorageUnitInfo> unit(new StorageUnitInfo()); systeminfo::BuildStorageUnitInfo(*it, unit.get()); - results.push_back(unit); + info_.push_back(unit); } - info->swap(results); - - return true; } void StorageInfoProvider::AddObserver(StorageFreeSpaceObserver* obs) { @@ -128,6 +129,20 @@ void StorageInfoProvider::StopWatching(const std::string& transient_id) { this, transient_id)); } +void StorageInfoProvider::StartWatchingAllStorages() { + for (StorageUnitInfoList::const_iterator it = info_.begin(); + it != info_.end(); ++it) { + StartWatching((*it)->id); + } +} + +void StorageInfoProvider::StopWatchingAllStorages() { + for (StorageUnitInfoList::const_iterator it = info_.begin(); + it != info_.end(); ++it) { + StopWatching((*it)->id); + } +} + int64 StorageInfoProvider::GetStorageFreeSpaceFromTransientId( const std::string& transient_id) { std::vector<chrome::StorageInfo> storage_list = GetAllStorages(); diff --git a/chrome/browser/extensions/api/system_info_storage/storage_info_provider.h b/chrome/browser/extensions/api/system_info_storage/storage_info_provider.h index cfa7397..a6138dd 100644 --- a/chrome/browser/extensions/api/system_info_storage/storage_info_provider.h +++ b/chrome/browser/extensions/api/system_info_storage/storage_info_provider.h @@ -33,9 +33,10 @@ void BuildStorageUnitInfo(const chrome::StorageInfo& info, } // namespace systeminfo typedef std::vector<linked_ptr< - api::experimental_system_info_storage::StorageUnitInfo> > StorageInfo; + api::experimental_system_info_storage::StorageUnitInfo> > + StorageUnitInfoList; -class StorageInfoProvider : public SystemInfoProvider<StorageInfo> { +class StorageInfoProvider : public SystemInfoProvider<StorageUnitInfoList> { public: StorageInfoProvider(); @@ -47,12 +48,21 @@ class StorageInfoProvider : public SystemInfoProvider<StorageInfo> { void RemoveObserver(StorageFreeSpaceObserver* obs); // Start and stop watching the given storage |transient_id|. - virtual void StartWatching(const std::string& transient_id); - virtual void StopWatching(const std::string& transient_id); + void StartWatching(const std::string& transient_id); + void StopWatching(const std::string& transient_id); + + // Start and stop watching all available storages. + void StartWatchingAllStorages(); + void StopWatchingAllStorages(); // Returns all available storages, including fixed and removable. virtual std::vector<chrome::StorageInfo> GetAllStorages() const; + // SystemInfoProvider implementations + virtual void PrepareQueryOnUIThread() OVERRIDE; + virtual void InitializeProvider(const base::Closure& do_query_info_callback) + OVERRIDE; + // Get the amount of storage free space from |transient_id|, or -1 on failure. virtual int64 GetStorageFreeSpaceFromTransientId( const std::string& transient_id); @@ -62,27 +72,26 @@ class StorageInfoProvider : public SystemInfoProvider<StorageInfo> { virtual std::string GetDeviceIdForTransientId( const std::string& transient_id) const; + const StorageUnitInfoList& storage_unit_info_list() const; + protected: virtual ~StorageInfoProvider(); // TODO(Haojian): Put this method in a testing subclass rather than here. void SetWatchingIntervalForTesting(size_t ms) { watching_interval_ = ms; } - // SystemInfoProvider implementations. - virtual bool QueryInfo(StorageInfo* info) OVERRIDE; - virtual void StartQueryInfoImpl() OVERRIDE; + // Put all available storages' information into |info_|. + virtual void GetAllStoragesIntoInfoList(); private: typedef std::map<std::string, double> StorageTransientIdToSizeMap; - // Query the available capacity of all known storage devices on the blocking - // pool, including fixed and removable. - void QueryAvailableCapacityOnBlockingPool(); + // SystemInfoProvider implementations. + // Override to query the available capacity of all known storage devices on + // the blocking pool, including fixed and removable devices. + virtual bool QueryInfo() OVERRIDE; // Query the new attached removable storage info on the blocking pool. void QueryAttachedStorageInfoOnBlockingPool(const std::string& transient_id); - // Run the QueryInfo() implementation after the StorageMonitor has been - // initialized. - void QueryInfoImplOnUIThread(); // Posts a task to check for free space changes on the blocking pool. // Should be called on the UI thread. diff --git a/chrome/browser/extensions/api/system_info_storage/system_info_storage_api.cc b/chrome/browser/extensions/api/system_info_storage/system_info_storage_api.cc index cc9d905..b126c65 100644 --- a/chrome/browser/extensions/api/system_info_storage/system_info_storage_api.cc +++ b/chrome/browser/extensions/api/system_info_storage/system_info_storage_api.cc @@ -20,12 +20,11 @@ bool SystemInfoStorageGetFunction::RunImpl() { return true; } -void SystemInfoStorageGetFunction::OnGetStorageInfoCompleted( - const StorageInfo& info, bool success) { - +void SystemInfoStorageGetFunction::OnGetStorageInfoCompleted(bool success) { if (success) { results_ = - api::experimental_system_info_storage::Get::Results::Create(info); + api::experimental_system_info_storage::Get::Results::Create( + StorageInfoProvider::Get()->storage_unit_info_list()); } else { SetError("Error occurred when querying storage information."); } diff --git a/chrome/browser/extensions/api/system_info_storage/system_info_storage_api.h b/chrome/browser/extensions/api/system_info_storage/system_info_storage_api.h index 02a4ff8..8699717 100644 --- a/chrome/browser/extensions/api/system_info_storage/system_info_storage_api.h +++ b/chrome/browser/extensions/api/system_info_storage/system_info_storage_api.h @@ -21,7 +21,7 @@ class SystemInfoStorageGetFunction : public AsyncExtensionFunction { virtual ~SystemInfoStorageGetFunction(); virtual bool RunImpl() OVERRIDE; - void OnGetStorageInfoCompleted(const StorageInfo& info, bool success); + void OnGetStorageInfoCompleted(bool success); }; class SystemInfoStorageAddWatchFunction : public AsyncExtensionFunction { diff --git a/chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc b/chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc index 40a1f8f..3c87491 100644 --- a/chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc +++ b/chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc @@ -22,7 +22,7 @@ using chrome::test::TestStorageMonitor; using extensions::api::experimental_system_info_storage::ParseStorageUnitType; using extensions::api::experimental_system_info_storage::StorageUnitInfo; using extensions::StorageInfoProvider; -using extensions::StorageInfo; +using extensions::StorageUnitInfoList; using extensions::systeminfo::kStorageTypeFixed; using extensions::systeminfo::kStorageTypeRemovable; using extensions::systeminfo::kStorageTypeUnknown; diff --git a/chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.cc b/chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.cc index 884bbf2..f90d2e1e 100644 --- a/chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.cc +++ b/chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.cc @@ -40,18 +40,16 @@ chrome::StorageInfo TestStorageInfoProvider::BuildStorageInfo( return info; } -bool TestStorageInfoProvider::QueryInfo(extensions::StorageInfo* info) { - info->clear(); +void TestStorageInfoProvider::GetAllStoragesIntoInfoList() { + info_.clear(); for (size_t i = 0; i < testing_data_.size(); ++i) { linked_ptr<StorageUnitInfo> unit(new StorageUnitInfo()); unit->id = testing_data_[i].transient_id; unit->name = testing_data_[i].name; unit->type = ParseStorageUnitType(testing_data_[i].type); unit->capacity = testing_data_[i].capacity; - unit->available_capacity = testing_data_[i].available_capacity; - info->push_back(unit); + info_.push_back(unit); } - return true; } std::vector<chrome::StorageInfo> diff --git a/chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.h b/chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.h index 1d2f42b..0ab3d4c 100644 --- a/chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.h +++ b/chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.h @@ -48,7 +48,7 @@ class TestStorageInfoProvider : public extensions::StorageInfoProvider { virtual ~TestStorageInfoProvider(); // StorageInfoProvider implementations. - virtual bool QueryInfo(extensions::StorageInfo* info) OVERRIDE; + virtual void GetAllStoragesIntoInfoList() OVERRIDE; virtual std::vector<chrome::StorageInfo> GetAllStorages() const OVERRIDE; virtual int64 GetStorageFreeSpaceFromTransientId( const std::string& transient_id) OVERRIDE; |