Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: ios/chrome/browser/ui/tab_switcher/tab_switcher_utils.mm

Issue 2602903002: Factor iOS native image loading into a utility function. (Closed)
Patch Set: Fixed BUILD files. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/tab_switcher/tab_switcher_utils.h" 5 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_utils.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #include "components/browser_sync/profile_sync_service.h" 11 #include "components/browser_sync/profile_sync_service.h"
12 #include "components/sync/driver/sync_service.h" 12 #include "components/sync/driver/sync_service.h"
13 #include "components/sync_sessions/open_tabs_ui_delegate.h" 13 #include "components/sync_sessions/open_tabs_ui_delegate.h"
14 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 14 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
15 #import "ios/chrome/browser/favicon/favicon_loader.h" 15 #import "ios/chrome/browser/favicon/favicon_loader.h"
16 #include "ios/chrome/browser/favicon/ios_chrome_favicon_loader_factory.h" 16 #include "ios/chrome/browser/favicon/ios_chrome_favicon_loader_factory.h"
17 #include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h" 17 #include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
18 #import "ios/chrome/browser/ui/uikit_ui_util.h"
18 #include "ios/chrome/grit/ios_theme_resources.h" 19 #include "ios/chrome/grit/ios_theme_resources.h"
19 #include "ui/base/resource/resource_bundle.h"
20 20
21 namespace ios_internal { 21 namespace ios_internal {
22 22
23 UIImage* DefaultFaviconImage() { 23 UIImage* DefaultFaviconImage() {
24 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 24 return NativeImage(IDR_IOS_OMNIBOX_HTTP);
25 return rb.GetNativeImageNamed(IDR_IOS_OMNIBOX_HTTP).ToUIImage();
26 } 25 }
27 26
28 void GetFavicon(GURL const& url, 27 void GetFavicon(GURL const& url,
29 ios::ChromeBrowserState* browser_state, 28 ios::ChromeBrowserState* browser_state,
30 ios_internal::FaviconGetterCompletionBlock block) { 29 ios_internal::FaviconGetterCompletionBlock block) {
31 DCHECK(browser_state); 30 DCHECK(browser_state);
32 syncer::SyncService* sync_service = 31 syncer::SyncService* sync_service =
33 IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state); 32 IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state);
34 sync_sessions::OpenTabsUIDelegate* open_tabs = 33 sync_sessions::OpenTabsUIDelegate* open_tabs =
35 sync_service ? sync_service->GetOpenTabsUIDelegate() : NULL; 34 sync_service ? sync_service->GetOpenTabsUIDelegate() : NULL;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 180
182 // The backtracking results in the indexes of the operations being stored in 181 // The backtracking results in the indexes of the operations being stored in
183 // decreasing order. 182 // decreasing order.
184 // For readability, order them in ascending value. 183 // For readability, order them in ascending value.
185 std::reverse(std::begin(*substitutions), std::end(*substitutions)); 184 std::reverse(std::begin(*substitutions), std::end(*substitutions));
186 std::reverse(std::begin(*deletions), std::end(*deletions)); 185 std::reverse(std::begin(*deletions), std::end(*deletions));
187 std::reverse(std::begin(*insertions), std::end(*insertions)); 186 std::reverse(std::begin(*insertions), std::end(*insertions));
188 } 187 }
189 188
190 } // namespace ios_internal 189 } // namespace ios_internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698