OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/browser/enhanced_bookmarks/android/enhanced_bookmark_tab_helper
.h" |
| 6 |
| 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_andro
id.h" |
| 10 #include "chrome/browser/enhanced_bookmarks/android/bookmark_image_service_facto
ry.h" |
| 11 #include "chrome/browser/profiles/profile.h" |
| 12 |
| 13 using enhanced_bookmarks::BookmarkImageServiceAndroid; |
| 14 using enhanced_bookmarks::BookmarkImageServiceFactory; |
| 15 |
| 16 DEFINE_WEB_CONTENTS_USER_DATA_KEY(EnhancedBookmarkTabHelper); |
| 17 |
| 18 void EnhancedBookmarkTabHelper::DocumentOnLoadCompletedInMainFrame() { |
| 19 Profile* profile = |
| 20 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 21 |
| 22 if (profile->IsOffTheRecord()) |
| 23 return; |
| 24 |
| 25 bool is_enhanced_bookmarks_enabled = |
| 26 IsEnhancedBookmarksEnabled(profile->GetPrefs()); |
| 27 if (!is_enhanced_bookmarks_enabled) |
| 28 return; |
| 29 |
| 30 BookmarkImageServiceAndroid* storage = |
| 31 static_cast<BookmarkImageServiceAndroid*>( |
| 32 BookmarkImageServiceFactory::GetForBrowserContext(profile)); |
| 33 storage->FinishSuccessfulPageLoadForTab(web_contents(), |
| 34 is_enhanced_bookmarks_enabled); |
| 35 } |
| 36 |
| 37 EnhancedBookmarkTabHelper::EnhancedBookmarkTabHelper( |
| 38 content::WebContents* contents) |
| 39 : content::WebContentsObserver(contents) { |
| 40 } |
OLD | NEW |