Index: chrome/browser/ui/webui/conflicts_ui.cc |
diff --git a/chrome/browser/ui/webui/conflicts_ui.cc b/chrome/browser/ui/webui/conflicts_ui.cc |
index 9779632156aee2c63274be3a7845e27024c010e2..d8053066f5adc03962839392d067cb8044d88b31 100644 |
--- a/chrome/browser/ui/webui/conflicts_ui.cc |
+++ b/chrome/browser/ui/webui/conflicts_ui.cc |
@@ -16,15 +16,11 @@ |
#include "base/strings/utf_string_conversions.h" |
#include "base/values.h" |
#include "build/build_config.h" |
-#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/enumerate_modules_model_win.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/common/url_constants.h" |
#include "chrome/grit/chromium_strings.h" |
#include "chrome/grit/generated_resources.h" |
-#include "content/public/browser/notification_observer.h" |
-#include "content/public/browser/notification_registrar.h" |
-#include "content/public/browser/notification_service.h" |
#include "content/public/browser/user_metrics.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/browser/web_ui.h" |
@@ -77,9 +73,9 @@ content::WebUIDataSource* CreateConflictsUIHTMLSource() { |
// |
//////////////////////////////////////////////////////////////////////////////// |
-// The handler for JavaScript messages for the about:flags page. |
+// The handler for JavaScript messages for the about:conflicts page. |
class ConflictsDOMHandler : public WebUIMessageHandler, |
- public content::NotificationObserver { |
+ public EnumerateModulesModel::Observer { |
public: |
ConflictsDOMHandler() {} |
~ConflictsDOMHandler() override {} |
@@ -93,11 +89,8 @@ class ConflictsDOMHandler : public WebUIMessageHandler, |
private: |
void SendModuleList(); |
- void Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) override; |
- |
- content::NotificationRegistrar registrar_; |
+ // EnumerateModulesModel::Observer implementation. |
+ void OnScanCompleted(bool limited) override; |
DISALLOW_COPY_AND_ASSIGN(ConflictsDOMHandler); |
}; |
@@ -109,10 +102,11 @@ void ConflictsDOMHandler::RegisterMessages() { |
} |
void ConflictsDOMHandler::HandleRequestModuleList(const base::ListValue* args) { |
- // This request is handled asynchronously. See Observe for when we reply back. |
- registrar_.Add(this, chrome::NOTIFICATION_MODULE_LIST_ENUMERATED, |
- content::NotificationService::AllSources()); |
- EnumerateModulesModel::GetInstance()->ScanNow(); |
+ // The request is handled asynchronously, and will callback via |
+ // OnScanCompleted on completion. |
+ auto model = EnumerateModulesModel::GetInstance(); |
+ model->AddObserver(this); |
+ model->ScanNow(); |
} |
void ConflictsDOMHandler::SendModuleList() { |
@@ -141,13 +135,12 @@ void ConflictsDOMHandler::SendModuleList() { |
web_ui()->CallJavascriptFunctionUnsafe("returnModuleList", results); |
} |
-void ConflictsDOMHandler::Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
- DCHECK_EQ(chrome::NOTIFICATION_MODULE_LIST_ENUMERATED, type); |
- |
+void ConflictsDOMHandler::OnScanCompleted(bool limited) { |
+ // Wait for a full 'unlimited' scan. |
+ if (limited) |
+ return; |
SendModuleList(); |
- registrar_.RemoveAll(); |
+ EnumerateModulesModel::GetInstance()->RemoveObserver(this); |
} |
} // namespace |