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

Unified Diff: ios/chrome/browser/ui/omnibox/location_bar_view_ios.mm

Issue 2602903002: Factor iOS native image loading into a utility function. (Closed)
Patch Set: Fixed BUILD files. Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/omnibox/location_bar_view_ios.mm
diff --git a/ios/chrome/browser/ui/omnibox/location_bar_view_ios.mm b/ios/chrome/browser/ui/omnibox/location_bar_view_ios.mm
index 123669e43c1e475d9adbc247bdb00c264b213fe1..17196888825e398f18472afcf9c9e8f7cef50672 100644
--- a/ios/chrome/browser/ui/omnibox/location_bar_view_ios.mm
+++ b/ios/chrome/browser/ui/omnibox/location_bar_view_ios.mm
@@ -29,9 +29,6 @@
#include "ios/web/public/ssl_status.h"
#include "ios/web/public/web_state/web_state.h"
#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/image/image.h"
namespace {
const CGFloat kClearTextButtonWidth = 28;
@@ -260,10 +257,8 @@ web::WebState* LocationBarViewIOS::GetWebState() {
void LocationBarViewIOS::InstallLocationIcon() {
// Set the placeholder for empty omnibox.
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- gfx::Image magImage = rb.GetNativeImageNamed(IDR_IOS_OMNIBOX_SEARCH);
UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
- UIImage* image = magImage.ToUIImage();
+ UIImage* image = NativeImage(IDR_IOS_OMNIBOX_SEARCH);
[button setImage:image forState:UIControlStateNormal];
[button setFrame:CGRectMake(0, 0, image.size.width, image.size.height)];
[button addTarget:nil
@@ -291,17 +286,13 @@ void LocationBarViewIOS::InstallLocationIcon() {
}
void LocationBarViewIOS::CreateClearTextIcon(bool is_incognito) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
- UIImage* omniBoxClearImage =
- is_incognito
- ? rb.GetNativeImageNamed(IDR_IOS_OMNIBOX_CLEAR_OTR).ToUIImage()
- : rb.GetNativeImageNamed(IDR_IOS_OMNIBOX_CLEAR).ToUIImage();
+ UIImage* omniBoxClearImage = is_incognito
+ ? NativeImage(IDR_IOS_OMNIBOX_CLEAR_OTR)
+ : NativeImage(IDR_IOS_OMNIBOX_CLEAR);
UIImage* omniBoxClearPressedImage =
- is_incognito
- ? rb.GetNativeImageNamed(IDR_IOS_OMNIBOX_CLEAR_OTR_PRESSED)
- .ToUIImage()
- : rb.GetNativeImageNamed(IDR_IOS_OMNIBOX_CLEAR_PRESSED).ToUIImage();
+ is_incognito ? NativeImage(IDR_IOS_OMNIBOX_CLEAR_OTR_PRESSED)
+ : NativeImage(IDR_IOS_OMNIBOX_CLEAR_PRESSED);
[button setImage:omniBoxClearImage forState:UIControlStateNormal];
[button setImage:omniBoxClearPressedImage forState:UIControlStateHighlighted];

Powered by Google App Engine
This is Rietveld 408576698