Index: chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc |
diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc b/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc |
index 0cf46ff67e6d571947bd72f0d7ba97033df431e7..d95d1bcb2d5620700a57afd834b4bd52ef35f05b 100644 |
--- a/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc |
+++ b/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc |
@@ -14,6 +14,7 @@ |
#include "chrome/browser/net/chrome_url_request_context.h" |
#include "chrome/browser/profiles/profile.h" |
#include "content/browser/renderer_host/render_view_host.h" |
+#include "content/browser/tab_contents/tab_contents.h" |
#include "grit/generated_resources.h" |
#include "net/base/cookie_monster.h" |
#include "net/url_request/url_request_context.h" |
@@ -98,7 +99,9 @@ NewTabPageSyncHandler::MessageType |
} |
WebUIMessageHandler* NewTabPageSyncHandler::Attach(WebUI* web_ui) { |
- sync_service_ = web_ui->GetProfile()->GetProfileSyncService(); |
+ Profile* profile = |
+ Profile::FromBrowserContext(web_ui->tab_contents()->browser_context()); |
+ sync_service_ = profile->GetProfileSyncService(); |
DCHECK(sync_service_); // This shouldn't get called by an incognito NTP. |
DCHECK(!sync_service_->IsManaged()); // And neither if sync is managed. |
sync_service_->AddObserver(this); |