| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/enhanced_bookmarks/android/enhanced_bookmark_tab_helper
.h" | 5 #include "chrome/browser/enhanced_bookmarks/android/enhanced_bookmark_tab_helper
.h" |
| 6 | 6 |
| 7 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | 7 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/enhanced_bookmarks/android/bookmark_image_service_andro
id.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" | 10 #include "chrome/browser/enhanced_bookmarks/android/bookmark_image_service_facto
ry.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 | 12 |
| 13 using enhanced_bookmarks::BookmarkImageServiceAndroid; | 13 using enhanced_bookmarks::BookmarkImageServiceAndroid; |
| 14 using enhanced_bookmarks::BookmarkImageServiceFactory; | 14 using enhanced_bookmarks::BookmarkImageServiceFactory; |
| 15 | 15 |
| 16 DEFINE_WEB_CONTENTS_USER_DATA_KEY(EnhancedBookmarkTabHelper); | 16 DEFINE_WEB_CONTENTS_USER_DATA_KEY(EnhancedBookmarkTabHelper); |
| 17 | 17 |
| 18 void EnhancedBookmarkTabHelper::DocumentOnLoadCompletedInMainFrame() { | 18 void EnhancedBookmarkTabHelper::DocumentOnLoadCompletedInMainFrame() { |
| 19 Profile* profile = | 19 Profile* profile = |
| 20 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 20 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 21 | 21 |
| 22 if (profile->IsOffTheRecord()) | 22 if (profile->IsOffTheRecord()) |
| 23 return; | 23 return; |
| 24 | 24 |
| 25 bool is_enhanced_bookmarks_enabled = | 25 if (!IsEnhancedBookmarksEnabled()) |
| 26 IsEnhancedBookmarksEnabled(profile->GetPrefs()); | |
| 27 if (!is_enhanced_bookmarks_enabled) | |
| 28 return; | 26 return; |
| 29 | 27 |
| 30 BookmarkImageServiceAndroid* storage = | 28 BookmarkImageServiceAndroid* storage = |
| 31 static_cast<BookmarkImageServiceAndroid*>( | 29 static_cast<BookmarkImageServiceAndroid*>( |
| 32 BookmarkImageServiceFactory::GetForBrowserContext(profile)); | 30 BookmarkImageServiceFactory::GetForBrowserContext(profile)); |
| 33 storage->FinishSuccessfulPageLoadForTab(web_contents(), | 31 storage->FinishSuccessfulPageLoadForTab(web_contents(), true); |
| 34 is_enhanced_bookmarks_enabled); | |
| 35 } | 32 } |
| 36 | 33 |
| 37 EnhancedBookmarkTabHelper::EnhancedBookmarkTabHelper( | 34 EnhancedBookmarkTabHelper::EnhancedBookmarkTabHelper( |
| 38 content::WebContents* contents) | 35 content::WebContents* contents) |
| 39 : content::WebContentsObserver(contents) { | 36 : content::WebContentsObserver(contents) { |
| 40 } | 37 } |
| OLD | NEW |