1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/enhanced_bookmarks/android/enhanced_bookmark_tab_helper.h"
7 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h"
8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/enhanced_bookmarks/android/bookmark_image_service_android.h"
10 #include "chrome/browser/enhanced_bookmarks/android/bookmark_image_service_factory.h"
11 #include "chrome/browser/profiles/profile.h"
13 using enhanced_bookmarks::BookmarkImageServiceAndroid
;
14 using enhanced_bookmarks::BookmarkImageServiceFactory
;
16 DEFINE_WEB_CONTENTS_USER_DATA_KEY(EnhancedBookmarkTabHelper
);
18 void EnhancedBookmarkTabHelper::DocumentOnLoadCompletedInMainFrame() {
20 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
22 if (profile
->IsOffTheRecord())
25 if (!IsEnhancedBookmarksEnabled())
28 BookmarkImageServiceAndroid
* storage
=
29 static_cast<BookmarkImageServiceAndroid
*>(
30 BookmarkImageServiceFactory::GetForBrowserContext(profile
));
31 storage
->FinishSuccessfulPageLoadForTab(web_contents(), true);
34 EnhancedBookmarkTabHelper::EnhancedBookmarkTabHelper(
35 content::WebContents
* contents
)
36 : content::WebContentsObserver(contents
) {