Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "ios/chrome/browser/ui/ntp/google_landing_controller.h" | 5 #import "ios/chrome/browser/ui/ntp/google_landing_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #import "base/ios/weak_nsobject.h" | 10 #import "base/ios/weak_nsobject.h" |
| 11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/mac/bind_objc_block.h" | 13 #include "base/mac/bind_objc_block.h" |
| 14 #include "base/mac/foundation_util.h" | 14 #include "base/mac/foundation_util.h" |
| 15 #include "base/mac/scoped_nsobject.h" | 15 #include "base/mac/scoped_nsobject.h" |
| 16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/metrics/user_metrics.h" | 17 #include "base/metrics/user_metrics.h" |
| 18 #include "base/metrics/user_metrics_action.h" | 18 #include "base/metrics/user_metrics_action.h" |
| 19 #include "base/strings/sys_string_conversions.h" | 19 #include "base/strings/sys_string_conversions.h" |
| 20 #include "components/favicon/core/large_icon_service.h" | 20 #include "components/favicon/core/large_icon_service.h" |
| 21 #include "components/keyed_service/core/service_access_type.h" | 21 #include "components/keyed_service/core/service_access_type.h" |
| 22 #include "components/ntp_tiles/most_visited_sites.h" | 22 #include "components/ntp_tiles/most_visited_sites.h" |
| 23 #include "components/ntp_tiles/ntp_tile.h" | 23 #include "components/ntp_tiles/ntp_tile.h" |
| 24 #include "components/rappor/rappor_service_impl.h" | 24 #include "components/rappor/rappor_service_impl.h" |
| 25 #include "components/reading_list/core/reading_list_switches.h" | |
| 26 #include "components/search_engines/template_url_service.h" | 25 #include "components/search_engines/template_url_service.h" |
| 27 #include "components/search_engines/template_url_service_observer.h" | 26 #include "components/search_engines/template_url_service_observer.h" |
| 28 #include "components/strings/grit/components_strings.h" | 27 #include "components/strings/grit/components_strings.h" |
| 29 #include "ios/chrome/browser/application_context.h" | 28 #include "ios/chrome/browser/application_context.h" |
| 30 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 29 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 31 #import "ios/chrome/browser/favicon/favicon_loader.h" | 30 #import "ios/chrome/browser/favicon/favicon_loader.h" |
| 32 #include "ios/chrome/browser/favicon/favicon_service_factory.h" | 31 #include "ios/chrome/browser/favicon/favicon_service_factory.h" |
| 33 #include "ios/chrome/browser/favicon/ios_chrome_favicon_loader_factory.h" | 32 #include "ios/chrome/browser/favicon/ios_chrome_favicon_loader_factory.h" |
| 34 #include "ios/chrome/browser/favicon/large_icon_cache.h" | 33 #include "ios/chrome/browser/favicon/large_icon_cache.h" |
| 35 #import "ios/chrome/browser/metrics/new_tab_page_uma.h" | 34 #import "ios/chrome/browser/metrics/new_tab_page_uma.h" |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1233 _headerView.reset([[collectionView | 1232 _headerView.reset([[collectionView |
| 1234 dequeueReusableSupplementaryViewOfKind: | 1233 dequeueReusableSupplementaryViewOfKind: |
| 1235 UICollectionElementKindSectionHeader | 1234 UICollectionElementKindSectionHeader |
| 1236 withReuseIdentifier:@"header" | 1235 withReuseIdentifier:@"header" |
| 1237 forIndexPath:indexPath] retain]); | 1236 forIndexPath:indexPath] retain]); |
| 1238 [_headerView addSubview:[_doodleController view]]; | 1237 [_headerView addSubview:[_doodleController view]]; |
| 1239 [_headerView addSubview:_searchTapTarget]; | 1238 [_headerView addSubview:_searchTapTarget]; |
| 1240 [_headerView addViewsToSearchField:_searchTapTarget]; | 1239 [_headerView addViewsToSearchField:_searchTapTarget]; |
| 1241 | 1240 |
| 1242 if (!IsIPadIdiom()) { | 1241 if (!IsIPadIdiom()) { |
| 1243 ReadingListModel* readingListModel = nullptr; | 1242 ReadingListModel* readingListModel = nullptr; |
|
sdefresne
2017/03/23 15:49:06
nit: merge the two lines
gambard
2017/03/23 15:53:16
Done.
| |
| 1244 if (reading_list::switches::IsReadingListEnabled()) { | 1243 readingListModel = |
| 1245 readingListModel = | 1244 ReadingListModelFactory::GetForBrowserState(_browserState); |
| 1246 ReadingListModelFactory::GetForBrowserState(_browserState); | |
| 1247 } | |
| 1248 // iPhone header also contains a toolbar since the normal toolbar is | 1245 // iPhone header also contains a toolbar since the normal toolbar is |
| 1249 // hidden. | 1246 // hidden. |
| 1250 [_headerView addToolbarWithDelegate:_webToolbarDelegate | 1247 [_headerView addToolbarWithDelegate:_webToolbarDelegate |
| 1251 focuser:_focuser | 1248 focuser:_focuser |
| 1252 tabModel:_tabModel | 1249 tabModel:_tabModel |
| 1253 readingListModel:readingListModel]; | 1250 readingListModel:readingListModel]; |
| 1254 } | 1251 } |
| 1255 [_supplementaryViews addObject:_headerView]; | 1252 [_supplementaryViews addObject:_headerView]; |
| 1256 } | 1253 } |
| 1257 return _headerView; | 1254 return _headerView; |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1742 if (!view) { | 1739 if (!view) { |
| 1743 return nil; | 1740 return nil; |
| 1744 } | 1741 } |
| 1745 if ([view isKindOfClass:aClass]) { | 1742 if ([view isKindOfClass:aClass]) { |
| 1746 return view; | 1743 return view; |
| 1747 } | 1744 } |
| 1748 return [self nearestAncestorOfView:[view superview] withClass:aClass]; | 1745 return [self nearestAncestorOfView:[view superview] withClass:aClass]; |
| 1749 } | 1746 } |
| 1750 | 1747 |
| 1751 @end | 1748 @end |
| OLD | NEW |