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

Unified Diff: chrome/browser/ui/views/load_complete_listener.cc

Issue 11515005: Delay updating jumplist to avoid blocking the file thread at start-up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
Index: chrome/browser/ui/views/load_complete_listener.cc
diff --git a/chrome/browser/ui/views/load_complete_listener.cc b/chrome/browser/ui/views/load_complete_listener.cc
new file mode 100644
index 0000000000000000000000000000000000000000..030aa47eaf066f54315f15ee26e07b152202988d
--- /dev/null
+++ b/chrome/browser/ui/views/load_complete_listener.cc
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/load_complete_listener.h"
+
+#include "chrome/common/chrome_notification_types.h"
+#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
+#include "content/public/browser/notification_types.h"
+
+LoadCompleteListener::LoadCompleteListener(Delegate* delegate)
+ : delegate_(delegate) {
+ registrar_ = new content::NotificationRegistrar();
+ // Register for notification of when initial page load is complete to ensure
+ // that we wait until start-up is complete before calling the callback.
+ registrar_->Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
+ content::NotificationService::AllSources());
+}
+
+LoadCompleteListener::~LoadCompleteListener() {
+}
+
+void LoadCompleteListener::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ switch (type) {
+ case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: {
+ delegate_->OnLoadCompleted();
+ registrar_->Remove(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
+ content::NotificationService::AllSources());
+ break;
+ }
+ default:
+ NOTREACHED() << "Unexpected notification type.";
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698