| Index: chrome/browser/jumplist_win.cc
|
| diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc
|
| index 91c01207d86bfd9a255787bf6b1a0d9a4ba007dd..e43af775e6865b8f2687b7072da06b836b2345c2 100644
|
| --- a/chrome/browser/jumplist_win.cc
|
| +++ b/chrome/browser/jumplist_win.cc
|
| @@ -37,7 +37,9 @@
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "content/public/browser/browser_thread.h"
|
| +#include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/notification_source.h"
|
| +#include "content/public/browser/notification_types.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "grit/chromium_strings.h"
|
| #include "grit/generated_resources.h"
|
| @@ -488,7 +490,9 @@ bool UpdateJumpList(const wchar_t* app_id,
|
| JumpList::JumpList()
|
| : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
|
| profile_(NULL),
|
| - task_id_(CancelableTaskTracker::kBadTaskId) {
|
| + task_id_(CancelableTaskTracker::kBadTaskId),
|
| + initial_page_load_pending_(true),
|
| + update_pending_(false) {
|
| }
|
|
|
| JumpList::~JumpList() {
|
| @@ -534,6 +538,10 @@ bool JumpList::AddObserver(Profile* profile) {
|
| // observers are detatched at that time.
|
| registrar_->Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
|
| content::Source<Profile>(profile_));
|
| + // Register for notification of when initial page load is complete to ensure
|
| + // that we wait until start-up is complete before updating the jumplist.
|
| + registrar_->Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
|
| + content::NotificationService::AllSources());
|
| }
|
| tab_restore_service->AddObserver(this);
|
| return true;
|
| @@ -558,6 +566,18 @@ void JumpList::Observe(int type,
|
| Terminate();
|
| break;
|
| }
|
| + case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: {
|
| + if (initial_page_load_pending_) {
|
| + initial_page_load_pending_ = false;
|
| + if (update_pending_) {
|
| + update_pending_ = false;
|
| + BrowserThread::PostTask(
|
| + BrowserThread::FILE, FROM_HERE,
|
| + base::Bind(&JumpList::RunUpdate, this));
|
| + }
|
| + }
|
| + break;
|
| + }
|
| default:
|
| NOTREACHED() << "Unexpected notification type.";
|
| }
|
| @@ -695,9 +715,13 @@ void JumpList::StartLoadingFavicon() {
|
| if (icon_urls_.empty()) {
|
| // No more favicons are needed by the application JumpList. Schedule a
|
| // RunUpdate call.
|
| - BrowserThread::PostTask(
|
| - BrowserThread::FILE, FROM_HERE,
|
| - base::Bind(&JumpList::RunUpdate, this));
|
| + if (initial_page_load_pending_) {
|
| + update_pending_ = true;
|
| + } else {
|
| + BrowserThread::PostTask(
|
| + BrowserThread::FILE, FROM_HERE,
|
| + base::Bind(&JumpList::RunUpdate, this));
|
| + }
|
| return;
|
| }
|
| // Ask FaviconService if it has a favicon of a URL.
|
|
|