| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/uikit_ui_util.h" | 5 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 6 | 6 |
| 7 #import <Accelerate/Accelerate.h> | 7 #import <Accelerate/Accelerate.h> |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 #import <QuartzCore/QuartzCore.h> | 9 #import <QuartzCore/QuartzCore.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| 11 #include <stdint.h> | 11 #include <stdint.h> |
| 12 #import <UIKit/UIKit.h> | 12 #import <UIKit/UIKit.h> |
| 13 #include <cmath> | 13 #include <cmath> |
| 14 | 14 |
| 15 #include "base/ios/ios_util.h" | |
| 16 #include "base/logging.h" | 15 #include "base/logging.h" |
| 17 #include "base/mac/foundation_util.h" | 16 #include "base/mac/foundation_util.h" |
| 18 #include "ios/chrome/browser/experimental_flags.h" | 17 #include "ios/chrome/browser/experimental_flags.h" |
| 19 #include "ios/chrome/browser/ui/rtl_geometry.h" | 18 #include "ios/chrome/browser/ui/rtl_geometry.h" |
| 20 #include "ios/chrome/browser/ui/ui_util.h" | 19 #include "ios/chrome/browser/ui/ui_util.h" |
| 21 #include "ios/web/public/web_thread.h" | 20 #include "ios/web/public/web_thread.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/l10n/l10n_util_mac.h" | 22 #include "ui/base/l10n/l10n_util_mac.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 25 #include "ui/gfx/ios/uikit_util.h" | 24 #include "ui/gfx/ios/uikit_util.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 view.layer.shadowPath = path; | 167 view.layer.shadowPath = path; |
| 169 view.layer.borderWidth = 0.0; | 168 view.layer.borderWidth = 0.0; |
| 170 CGPathRelease(path); | 169 CGPathRelease(path); |
| 171 } | 170 } |
| 172 | 171 |
| 173 UIImage* CaptureViewWithOption(UIView* view, | 172 UIImage* CaptureViewWithOption(UIView* view, |
| 174 CGFloat scale, | 173 CGFloat scale, |
| 175 CaptureViewOption option) { | 174 CaptureViewOption option) { |
| 176 UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES /* opaque */, | 175 UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES /* opaque */, |
| 177 scale); | 176 scale); |
| 178 if (base::ios::IsRunningOnIOS9OrLater() && option != kClientSideRendering) { | 177 if (option != kClientSideRendering) { |
| 179 [view drawViewHierarchyInRect:view.bounds | 178 [view drawViewHierarchyInRect:view.bounds |
| 180 afterScreenUpdates:option == kAfterScreenUpdate]; | 179 afterScreenUpdates:option == kAfterScreenUpdate]; |
| 181 } else { | 180 } else { |
| 182 CGContext* context = UIGraphicsGetCurrentContext(); | 181 CGContext* context = UIGraphicsGetCurrentContext(); |
| 183 [view.layer renderInContext:context]; | 182 [view.layer renderInContext:context]; |
| 184 } | 183 } |
| 185 UIImage* image = UIGraphicsGetImageFromCurrentImageContext(); | 184 UIImage* image = UIGraphicsGetImageFromCurrentImageContext(); |
| 186 UIGraphicsEndImageContext(); | 185 UIGraphicsEndImageContext(); |
| 187 return image; | 186 return image; |
| 188 } | 187 } |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 DCHECK(!gFirstResponder); | 653 DCHECK(!gFirstResponder); |
| 655 [[UIApplication sharedApplication] | 654 [[UIApplication sharedApplication] |
| 656 sendAction:@selector(cr_markSelfCurrentFirstResponder) | 655 sendAction:@selector(cr_markSelfCurrentFirstResponder) |
| 657 to:nil | 656 to:nil |
| 658 from:nil | 657 from:nil |
| 659 forEvent:nil]; | 658 forEvent:nil]; |
| 660 UIResponder* firstResponder = gFirstResponder; | 659 UIResponder* firstResponder = gFirstResponder; |
| 661 gFirstResponder = nil; | 660 gFirstResponder = nil; |
| 662 return firstResponder; | 661 return firstResponder; |
| 663 } | 662 } |
| OLD | NEW |