diff options
author | avi <avi@chromium.org> | 2015-12-19 21:48:44 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-20 05:49:56 +0000 |
commit | de7d5c230a354845b965ce751957c1f156f31021 (patch) | |
tree | befbd547f91f5d01066db30f3b58090a0b6bd70c /android_webview/native | |
parent | 60b1edd4e5d2309e9fbc1236f5edbae49b973d20 (diff) | |
download | chromium_src-de7d5c230a354845b965ce751957c1f156f31021.zip chromium_src-de7d5c230a354845b965ce751957c1f156f31021.tar.gz chromium_src-de7d5c230a354845b965ce751957c1f156f31021.tar.bz2 |
Switch to standard integer types in android_webview/.
BUG=488550
TBR=mnaganov@chromium.org
Review URL: https://codereview.chromium.org/1538223002
Cr-Commit-Position: refs/heads/master@{#366299}
Diffstat (limited to 'android_webview/native')
31 files changed, 121 insertions, 99 deletions
diff --git a/android_webview/native/aw_autofill_client.h b/android_webview/native/aw_autofill_client.h index b4278ed..290c669 100644 --- a/android_webview/native/aw_autofill_client.h +++ b/android_webview/native/aw_autofill_client.h @@ -9,8 +9,8 @@ #include <vector> #include "base/android/jni_weak_ref.h" -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service_factory.h" #include "components/autofill/core/browser/autofill_client.h" diff --git a/android_webview/native/aw_browser_dependency_factory.h b/android_webview/native/aw_browser_dependency_factory.h index 0824302..9990ecce 100644 --- a/android_webview/native/aw_browser_dependency_factory.h +++ b/android_webview/native/aw_browser_dependency_factory.h @@ -5,7 +5,7 @@ #ifndef ANDROID_WEBVIEW_AW_BROWSER_DELEGATE_H_ #define ANDROID_WEBVIEW_AW_BROWSER_DELEGATE_H_ -#include "base/basictypes.h" +#include "base/macros.h" namespace content { class BrowserContext; diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc index a3bcf2f..4fa96ac 100644 --- a/android_webview/native/aw_contents.cc +++ b/android_webview/native/aw_contents.cc @@ -387,7 +387,8 @@ void AwContents::DocumentHasImages(JNIEnv* env, namespace { void GenerateMHTMLCallback(ScopedJavaGlobalRef<jobject>* callback, - const base::FilePath& path, int64 size) { + const base::FilePath& path, + int64_t size) { JNIEnv* env = AttachCurrentThread(); // Android files are UTF8, so the path conversion below is safe. Java_AwContents_generateMHTMLCallback( @@ -791,8 +792,9 @@ base::android::ScopedJavaLocalRef<jbyteArray> AwContents::GetCertificate( // Convert the certificate and return it std::string der_string; net::X509Certificate::GetDEREncoded(cert->os_cert_handle(), &der_string); - return base::android::ToJavaByteArray(env, - reinterpret_cast<const uint8*>(der_string.data()), der_string.length()); + return base::android::ToJavaByteArray( + env, reinterpret_cast<const uint8_t*>(der_string.data()), + der_string.length()); } void AwContents::RequestNewHitTestDataAt(JNIEnv* env, @@ -915,8 +917,8 @@ base::android::ScopedJavaLocalRef<jbyteArray> AwContents::GetOpaqueState( if (!WriteToPickle(*web_contents_, &pickle)) { return ScopedJavaLocalRef<jbyteArray>(); } else { - return base::android::ToJavaByteArray(env, - reinterpret_cast<const uint8*>(pickle.data()), pickle.size()); + return base::android::ToJavaByteArray( + env, reinterpret_cast<const uint8_t*>(pickle.data()), pickle.size()); } } @@ -927,7 +929,7 @@ jboolean AwContents::RestoreFromOpaqueState( DCHECK_CURRENTLY_ON(BrowserThread::UI); // TODO(boliu): This copy can be optimized out if this is a performance // problem. - std::vector<uint8> state_vector; + std::vector<uint8_t> state_vector; base::android::JavaByteArrayToByteVector(env, state, &state_vector); base::Pickle pickle(reinterpret_cast<const char*>(state_vector.data()), diff --git a/android_webview/native/aw_contents.h b/android_webview/native/aw_contents.h index 22fe1b1..1ab42eb 100644 --- a/android_webview/native/aw_contents.h +++ b/android_webview/native/aw_contents.h @@ -22,6 +22,7 @@ #include "base/android/jni_weak_ref.h" #include "base/android/scoped_java_ref.h" #include "base/callback_forward.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" class SkBitmap; diff --git a/android_webview/native/aw_contents_client_bridge.cc b/android_webview/native/aw_contents_client_bridge.cc index 2dae8f5..02db65b 100644 --- a/android_webview/native/aw_contents_client_bridge.cc +++ b/android_webview/native/aw_contents_client_bridge.cc @@ -91,8 +91,7 @@ void AwContentsClientBridge::AllowCertificateError( std::string der_string; net::X509Certificate::GetDEREncoded(cert->os_cert_handle(), &der_string); ScopedJavaLocalRef<jbyteArray> jcert = base::android::ToJavaByteArray( - env, - reinterpret_cast<const uint8*>(der_string.data()), + env, reinterpret_cast<const uint8_t*>(der_string.data()), der_string.length()); ScopedJavaLocalRef<jstring> jurl(ConvertUTF8ToJavaString( env, request_url.spec())); diff --git a/android_webview/native/aw_contents_client_bridge_unittest.cc b/android_webview/native/aw_contents_client_bridge_unittest.cc index e685d0b..212befb 100644 --- a/android_webview/native/aw_contents_client_bridge_unittest.cc +++ b/android_webview/native/aw_contents_client_bridge_unittest.cc @@ -19,7 +19,6 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" - using base::android::AttachCurrentThread; using base::android::ScopedJavaLocalRef; using net::SSLCertRequestInfo; diff --git a/android_webview/native/aw_contents_io_thread_client_impl.cc b/android_webview/native/aw_contents_io_thread_client_impl.cc index 9a4aedd..89c2af7 100644 --- a/android_webview/native/aw_contents_io_thread_client_impl.cc +++ b/android_webview/native/aw_contents_io_thread_client_impl.cc @@ -383,7 +383,7 @@ void AwContentsIoThreadClientImpl::NewDownload( const string& user_agent, const string& content_disposition, const string& mime_type, - int64 content_length) { + int64_t content_length) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (java_object_.is_null()) return; diff --git a/android_webview/native/aw_contents_io_thread_client_impl.h b/android_webview/native/aw_contents_io_thread_client_impl.h index 01d8747b..1df03ca 100644 --- a/android_webview/native/aw_contents_io_thread_client_impl.h +++ b/android_webview/native/aw_contents_io_thread_client_impl.h @@ -7,9 +7,11 @@ #include "android_webview/browser/aw_contents_io_thread_client.h" +#include <stdint.h> + #include "base/android/scoped_java_ref.h" -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" class GURL; @@ -58,7 +60,7 @@ class AwContentsIoThreadClientImpl : public AwContentsIoThreadClient { const std::string& user_agent, const std::string& content_disposition, const std::string& mime_type, - int64 content_length) override; + int64_t content_length) override; void NewLoginRequest(const std::string& realm, const std::string& account, const std::string& args) override; diff --git a/android_webview/native/aw_dev_tools_server.h b/android_webview/native/aw_dev_tools_server.h index e3b5640..45bc61b 100644 --- a/android_webview/native/aw_dev_tools_server.h +++ b/android_webview/native/aw_dev_tools_server.h @@ -8,7 +8,7 @@ #include <jni.h> #include <vector> -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" namespace devtools_http_handler { diff --git a/android_webview/native/aw_locale_manager_impl.h b/android_webview/native/aw_locale_manager_impl.h index 83bed44..e0c081e 100644 --- a/android_webview/native/aw_locale_manager_impl.h +++ b/android_webview/native/aw_locale_manager_impl.h @@ -6,7 +6,8 @@ #define ANDROID_WEBVIEW_NATIVE_AW_LOCALE_MANAGER_IMPL_H_ #include "android_webview/browser/aw_locale_manager.h" -#include "base/basictypes.h" + +#include "base/macros.h" namespace android_webview { diff --git a/android_webview/native/aw_media_url_interceptor.cc b/android_webview/native/aw_media_url_interceptor.cc index fd85ffc..3ec6eea 100644 --- a/android_webview/native/aw_media_url_interceptor.cc +++ b/android_webview/native/aw_media_url_interceptor.cc @@ -14,8 +14,8 @@ namespace android_webview { bool AwMediaUrlInterceptor::Intercept(const std::string& url, int* fd, - int64* offset, - int64* size) const{ + int64_t* offset, + int64_t* size) const { std::string asset_file_prefix(url::kFileScheme); asset_file_prefix.append(url::kStandardSchemeSeparator); asset_file_prefix.append(android_webview::kAndroidAssetPath); diff --git a/android_webview/native/aw_media_url_interceptor.h b/android_webview/native/aw_media_url_interceptor.h index 332fd37..4f46e4d 100644 --- a/android_webview/native/aw_media_url_interceptor.h +++ b/android_webview/native/aw_media_url_interceptor.h @@ -5,6 +5,8 @@ #ifndef ANDROID_WEBVIEW_NATIVE_AW_MEDIA_URL_INTERCEPTOR_H_ #define ANDROID_WEBVIEW_NATIVE_AW_MEDIA_URL_INTERCEPTOR_H_ +#include <stdint.h> + #include <string> #include "base/android/jni_android.h" @@ -17,8 +19,8 @@ class AwMediaUrlInterceptor : public media::MediaUrlInterceptor { public: bool Intercept(const std::string& url, int* fd, - int64* offset, - int64* size) const override; + int64_t* offset, + int64_t* size) const override; }; } // namespace android_webview diff --git a/android_webview/native/aw_media_url_interceptor_unittest.cc b/android_webview/native/aw_media_url_interceptor_unittest.cc index be519e5..0f0ee0dd 100644 --- a/android_webview/native/aw_media_url_interceptor_unittest.cc +++ b/android_webview/native/aw_media_url_interceptor_unittest.cc @@ -26,8 +26,8 @@ class AwMediaUrlInterceptorTest : public Test { } protected: int fd_; - int64 offset_; - int64 size_; + int64_t offset_; + int64_t size_; scoped_ptr<AwMediaUrlInterceptor> url_interceptor_; }; diff --git a/android_webview/native/aw_message_port_service_impl.h b/android_webview/native/aw_message_port_service_impl.h index 2ee31b4..f62b76e 100644 --- a/android_webview/native/aw_message_port_service_impl.h +++ b/android_webview/native/aw_message_port_service_impl.h @@ -10,7 +10,7 @@ #include "android_webview/browser/aw_message_port_service.h" #include "base/android/jni_weak_ref.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/strings/string16.h" diff --git a/android_webview/native/aw_pdf_exporter.h b/android_webview/native/aw_pdf_exporter.h index 2b44a85..af22594 100644 --- a/android_webview/native/aw_pdf_exporter.h +++ b/android_webview/native/aw_pdf_exporter.h @@ -9,7 +9,7 @@ #include "base/android/jni_weak_ref.h" #include "base/android/scoped_java_ref.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "skia/ext/refptr.h" namespace content { diff --git a/android_webview/native/aw_picture.h b/android_webview/native/aw_picture.h index bc129e5..0b0eeb7 100644 --- a/android_webview/native/aw_picture.h +++ b/android_webview/native/aw_picture.h @@ -9,6 +9,7 @@ #include "base/android/jni_weak_ref.h" #include "base/android/scoped_java_ref.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "content/public/browser/web_contents_observer.h" #include "skia/ext/refptr.h" diff --git a/android_webview/native/aw_quota_manager_bridge_impl.cc b/android_webview/native/aw_quota_manager_bridge_impl.cc index d4ae0cd..7c44772 100644 --- a/android_webview/native/aw_quota_manager_bridge_impl.cc +++ b/android_webview/native/aw_quota_manager_bridge_impl.cc @@ -50,8 +50,8 @@ class GetOriginsTask : public base::RefCountedThreadSafe<GetOriginsTask> { void OnUsageAndQuotaObtained(const GURL& origin, storage::QuotaStatusCode status_code, - int64 usage, - int64 quota); + int64_t usage, + int64_t quota); void CheckDone(); void DoneOnUIThread(); @@ -60,8 +60,8 @@ class GetOriginsTask : public base::RefCountedThreadSafe<GetOriginsTask> { scoped_refptr<QuotaManager> quota_manager_; std::vector<std::string> origin_; - std::vector<int64> usage_; - std::vector<int64> quota_; + std::vector<int64_t> usage_; + std::vector<int64_t> quota_; size_t num_callbacks_to_wait_; size_t num_callbacks_received_; @@ -112,8 +112,8 @@ void GetOriginsTask::OnOriginsObtained(const std::set<GURL>& origins, void GetOriginsTask::OnUsageAndQuotaObtained( const GURL& origin, storage::QuotaStatusCode status_code, - int64 usage, - int64 quota) { + int64_t usage, + int64_t quota) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (status_code == storage::kQuotaStatusOk) { origin_.push_back(origin.spec()); @@ -273,8 +273,8 @@ void AwQuotaManagerBridgeImpl::GetOriginsOnUiThread(jint callback_id) { void AwQuotaManagerBridgeImpl::GetOriginsCallbackImpl( int jcallback_id, const std::vector<std::string>& origin, - const std::vector<int64>& usage, - const std::vector<int64>& quota) { + const std::vector<int64_t>& usage, + const std::vector<int64_t>& quota) { DCHECK_CURRENTLY_ON(BrowserThread::UI); JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); @@ -295,8 +295,8 @@ namespace { void OnUsageAndQuotaObtained( const AwQuotaManagerBridgeImpl::QuotaUsageCallback& ui_callback, storage::QuotaStatusCode status_code, - int64 usage, - int64 quota) { + int64_t usage, + int64_t quota) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (status_code != storage::kQuotaStatusOk) { usage = 0; @@ -347,8 +347,10 @@ void AwQuotaManagerBridgeImpl::GetUsageAndQuotaForOriginOnUiThread( base::Bind(&OnUsageAndQuotaObtained, ui_callback))); } -void AwQuotaManagerBridgeImpl::QuotaUsageCallbackImpl( - int jcallback_id, bool is_quota, int64 usage, int64 quota) { +void AwQuotaManagerBridgeImpl::QuotaUsageCallbackImpl(int jcallback_id, + bool is_quota, + int64_t usage, + int64_t quota) { DCHECK_CURRENTLY_ON(BrowserThread::UI); JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); diff --git a/android_webview/native/aw_quota_manager_bridge_impl.h b/android_webview/native/aw_quota_manager_bridge_impl.h index 530705d..1b0970b 100644 --- a/android_webview/native/aw_quota_manager_bridge_impl.h +++ b/android_webview/native/aw_quota_manager_bridge_impl.h @@ -6,13 +6,15 @@ #define ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_ #include <jni.h> +#include <stdint.h> + #include <string> #include <vector> #include "android_webview/browser/aw_quota_manager_bridge.h" #include "base/android/jni_weak_ref.h" -#include "base/basictypes.h" #include "base/callback.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" @@ -53,12 +55,12 @@ class AwQuotaManagerBridgeImpl : public AwQuotaManagerBridge { jint callback_id, bool is_quota); - typedef base::Callback< - void(const std::vector<std::string>& /* origin */, - const std::vector<int64>& /* usage */, - const std::vector<int64>& /* quota */)> GetOriginsCallback; - typedef base::Callback<void(int64 /* usage */, - int64 /* quota */)> QuotaUsageCallback; + typedef base::Callback<void(const std::vector<std::string>& /* origin */, + const std::vector<int64_t>& /* usage */, + const std::vector<int64_t>& /* quota */)> + GetOriginsCallback; + typedef base::Callback<void(int64_t /* usage */, int64_t /* quota */)> + QuotaUsageCallback; private: explicit AwQuotaManagerBridgeImpl(AwBrowserContext* browser_context); @@ -75,13 +77,14 @@ class AwQuotaManagerBridgeImpl : public AwQuotaManagerBridge { jint callback_id, bool is_quota); - void GetOriginsCallbackImpl( - int jcallback_id, - const std::vector<std::string>& origin, - const std::vector<int64>& usage, - const std::vector<int64>& quota); - void QuotaUsageCallbackImpl( - int jcallback_id, bool is_quota, int64 usage, int64 quota); + void GetOriginsCallbackImpl(int jcallback_id, + const std::vector<std::string>& origin, + const std::vector<int64_t>& usage, + const std::vector<int64_t>& quota); + void QuotaUsageCallbackImpl(int jcallback_id, + bool is_quota, + int64_t usage, + int64_t quota); AwBrowserContext* browser_context_; JavaObjectWeakGlobalRef java_ref_; diff --git a/android_webview/native/aw_web_resource_response_impl.h b/android_webview/native/aw_web_resource_response_impl.h index d12edeb..e3ec387 100644 --- a/android_webview/native/aw_web_resource_response_impl.h +++ b/android_webview/native/aw_web_resource_response_impl.h @@ -8,6 +8,7 @@ #include "android_webview/browser/net/aw_web_resource_response.h" #include "base/android/scoped_java_ref.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" namespace net { diff --git a/android_webview/native/input_stream_impl.h b/android_webview/native/input_stream_impl.h index aebd7ac..d4ce755 100644 --- a/android_webview/native/input_stream_impl.h +++ b/android_webview/native/input_stream_impl.h @@ -5,9 +5,12 @@ #ifndef ANDROID_WEBVIEW_NATIVE_INPUT_STREAM_H_ #define ANDROID_WEBVIEW_NATIVE_INPUT_STREAM_H_ +#include <stdint.h> + #include "android_webview/browser/input_stream.h" #include "base/android/scoped_java_ref.h" #include "base/compiler_specific.h" +#include "base/macros.h" namespace net { class IOBuffer; diff --git a/android_webview/native/permission/aw_permission_request.cc b/android_webview/native/permission/aw_permission_request.cc index 27f0b5b..1eb5401 100644 --- a/android_webview/native/permission/aw_permission_request.cc +++ b/android_webview/native/permission/aw_permission_request.cc @@ -79,7 +79,7 @@ const GURL& AwPermissionRequest::GetOrigin() { return delegate_->GetOrigin(); } -int64 AwPermissionRequest::GetResources() { +int64_t AwPermissionRequest::GetResources() { return delegate_->GetResources(); } diff --git a/android_webview/native/permission/aw_permission_request.h b/android_webview/native/permission/aw_permission_request.h index f016799..c8350c4 100644 --- a/android_webview/native/permission/aw_permission_request.h +++ b/android_webview/native/permission/aw_permission_request.h @@ -5,8 +5,11 @@ #ifndef ANDROID_WEBVIEW_NATIVE_PERMISSION_AW_PERMISSION_REQUEST_H #define ANDROID_WEBVIEW_NATIVE_PERMISSION_AW_PERMISSION_REQUEST_H +#include <stdint.h> + #include "base/android/jni_weak_ref.h" #include "base/android/scoped_java_ref.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "url/gurl.h" @@ -50,7 +53,7 @@ class AwPermissionRequest { const GURL& GetOrigin(); // Return the resources origin requested. - int64 GetResources(); + int64_t GetResources(); // Cancel this request. Guarantee that // AwPermissionRequestDelegate::NotifyRequestResult will not be called after diff --git a/android_webview/native/permission/aw_permission_request_delegate.h b/android_webview/native/permission/aw_permission_request_delegate.h index 61402b3..45d80c3 100644 --- a/android_webview/native/permission/aw_permission_request_delegate.h +++ b/android_webview/native/permission/aw_permission_request_delegate.h @@ -5,7 +5,8 @@ #ifndef ANDROID_WEBVIEW_NATIVE_PERMISSION_AW_PERMISSION_REQUEST_DELEGATE_H #define ANDROID_WEBVIEW_NATIVE_PERMISSION_AW_PERMISSION_REQUEST_DELEGATE_H -#include "base/basictypes.h" +#include <stdint.h> + #include "base/macros.h" #include "url/gurl.h" @@ -21,7 +22,7 @@ class AwPermissionRequestDelegate { virtual const GURL& GetOrigin() = 0; // Get the resources the origin wanted to access. - virtual int64 GetResources() = 0; + virtual int64_t GetResources() = 0; // Notify the permission request is allowed or not. virtual void NotifyRequestResult(bool allowed) = 0; diff --git a/android_webview/native/permission/media_access_permission_request.cc b/android_webview/native/permission/media_access_permission_request.cc index 6ef8c07..f4ecab5 100644 --- a/android_webview/native/permission/media_access_permission_request.cc +++ b/android_webview/native/permission/media_access_permission_request.cc @@ -81,7 +81,7 @@ const GURL& MediaAccessPermissionRequest::GetOrigin() { return request_.security_origin; } -int64 MediaAccessPermissionRequest::GetResources() { +int64_t MediaAccessPermissionRequest::GetResources() { return (request_.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE ? AwPermissionRequest::AudioCapture : 0) | (request_.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE ? diff --git a/android_webview/native/permission/media_access_permission_request.h b/android_webview/native/permission/media_access_permission_request.h index 01bc83e..ed6ae7e 100644 --- a/android_webview/native/permission/media_access_permission_request.h +++ b/android_webview/native/permission/media_access_permission_request.h @@ -5,8 +5,11 @@ #ifndef ANDROID_WEBVIEW_NATIVE_PERMISSION_MEDIA_ACCESS_PERMISSION_REQUEST_H #define ANDROID_WEBVIEW_NATIVE_PERMISSION_MEDIA_ACCESS_PERMISSION_REQUEST_H +#include <stdint.h> + #include "android_webview/native/permission/aw_permission_request_delegate.h" #include "base/callback.h" +#include "base/macros.h" #include "content/public/common/media_stream_request.h" namespace android_webview { @@ -21,7 +24,7 @@ class MediaAccessPermissionRequest : public AwPermissionRequestDelegate { // AwPermissionRequestDelegate implementation. const GURL& GetOrigin() override; - int64 GetResources() override; + int64_t GetResources() override; void NotifyRequestResult(bool allowed) override; private: diff --git a/android_webview/native/permission/permission_request_handler.cc b/android_webview/native/permission/permission_request_handler.cc index 28c359e..e16b2c5 100644 --- a/android_webview/native/permission/permission_request_handler.cc +++ b/android_webview/native/permission/permission_request_handler.cc @@ -57,7 +57,7 @@ void PermissionRequestHandler::SendRequest( } void PermissionRequestHandler::CancelRequest(const GURL& origin, - int64 resources) { + int64_t resources) { // The request list might have multiple requests with same origin and // resources. RequestIterator i = FindRequest(origin, resources); @@ -69,7 +69,7 @@ void PermissionRequestHandler::CancelRequest(const GURL& origin, } void PermissionRequestHandler::PreauthorizePermission(const GURL& origin, - int64 resources) { + int64_t resources) { if (!resources) return; @@ -94,9 +94,9 @@ void PermissionRequestHandler::NavigationEntryCommitted( } } -PermissionRequestHandler::RequestIterator -PermissionRequestHandler::FindRequest(const GURL& origin, - int64 resources) { +PermissionRequestHandler::RequestIterator PermissionRequestHandler::FindRequest( + const GURL& origin, + int64_t resources) { RequestIterator i; for (i = requests_.begin(); i != requests_.end(); ++i) { if (i->get() && i->get()->GetOrigin() == origin && @@ -130,8 +130,8 @@ void PermissionRequestHandler::PruneRequests() { } bool PermissionRequestHandler::Preauthorized(const GURL& origin, - int64 resources) { - std::map<std::string, int64>::iterator i = + int64_t resources) { + std::map<std::string, int64_t>::iterator i = preauthorized_permission_.find(origin.GetOrigin().spec()); return i != preauthorized_permission_.end() && diff --git a/android_webview/native/permission/permission_request_handler.h b/android_webview/native/permission/permission_request_handler.h index 37b0b71..f83b97e 100644 --- a/android_webview/native/permission/permission_request_handler.h +++ b/android_webview/native/permission/permission_request_handler.h @@ -5,9 +5,12 @@ #ifndef ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H #define ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H +#include <stdint.h> + #include <map> #include <vector> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "content/public/browser/web_contents_observer.h" @@ -33,10 +36,10 @@ class PermissionRequestHandler : public content::WebContentsObserver { void SendRequest(scoped_ptr<AwPermissionRequestDelegate> request); // Cancel the ongoing request initiated by |origin| for accessing |resources|. - void CancelRequest(const GURL& origin, int64 resources); + void CancelRequest(const GURL& origin, int64_t resources); // Allow |origin| to access the |resources|. - void PreauthorizePermission(const GURL& origin, int64 resources); + void PreauthorizePermission(const GURL& origin, int64_t resources); // WebContentsObserver void NavigationEntryCommitted( @@ -49,7 +52,7 @@ class PermissionRequestHandler : public content::WebContentsObserver { RequestIterator; // Return the request initiated by |origin| for accessing |resources|. - RequestIterator FindRequest(const GURL& origin, int64 resources); + RequestIterator FindRequest(const GURL& origin, int64_t resources); // Cancel the given request. void CancelRequestInternal(RequestIterator i); @@ -60,14 +63,14 @@ class PermissionRequestHandler : public content::WebContentsObserver { void PruneRequests(); // Return true if |origin| were preauthorized to access |resources|. - bool Preauthorized(const GURL& origin, int64 resources); + bool Preauthorized(const GURL& origin, int64_t resources); PermissionRequestHandlerClient* client_; // A list of ongoing requests. std::vector<base::WeakPtr<AwPermissionRequest> > requests_; - std::map<std::string, int64> preauthorized_permission_; + std::map<std::string, int64_t> preauthorized_permission_; // The unique id of the active NavigationEntry of the WebContents that we were // opened for. Used to help expire on requests. diff --git a/android_webview/native/permission/permission_request_handler_unittest.cc b/android_webview/native/permission/permission_request_handler_unittest.cc index 543c2ce..dadce71 100644 --- a/android_webview/native/permission/permission_request_handler_unittest.cc +++ b/android_webview/native/permission/permission_request_handler_unittest.cc @@ -14,24 +14,23 @@ namespace android_webview { class TestAwPermissionRequestDelegate : public AwPermissionRequestDelegate { public: - TestAwPermissionRequestDelegate( - const GURL& origin, int64 resources, base::Callback<void(bool)> callback) - : origin_(origin), - resources_(resources), - callback_(callback) {} + TestAwPermissionRequestDelegate(const GURL& origin, + int64_t resources, + base::Callback<void(bool)> callback) + : origin_(origin), resources_(resources), callback_(callback) {} // Get the origin which initiated the permission request. const GURL& GetOrigin() override { return origin_; } // Get the resources the origin wanted to access. - int64 GetResources() override { return resources_; } + int64_t GetResources() override { return resources_; } // Notify the permission request is allowed or not. void NotifyRequestResult(bool allowed) override { callback_.Run(allowed); } private: GURL origin_; - int64 resources_; + int64_t resources_; base::Callback<void(bool)> callback_; }; @@ -41,11 +40,10 @@ class TestPermissionRequestHandlerClient : struct Permission { Permission() :resources(0) {} - Permission(const GURL& origin, int64 resources) - : origin(origin), - resources(resources) {} + Permission(const GURL& origin, int64_t resources) + : origin(origin), resources(resources) {} GURL origin; - int64 resources; + int64_t resources; }; TestPermissionRequestHandlerClient() @@ -145,9 +143,7 @@ class PermissionRequestHandlerTest : public testing::Test { return origin_; } - int64 resources() { - return resources_; - } + int64_t resources() { return resources_; } scoped_ptr<AwPermissionRequestDelegate> delegate() { return delegate_.Pass(); @@ -167,7 +163,7 @@ class PermissionRequestHandlerTest : public testing::Test { private: GURL origin_; - int64 resources_; + int64_t resources_; scoped_ptr<AwPermissionRequestDelegate> delegate_; TestPermissionRequestHandlerClient client_; TestPermissionRequestHandler handler_; @@ -216,7 +212,7 @@ TEST_F(PermissionRequestHandlerTest, TestPermissionDenied) { TEST_F(PermissionRequestHandlerTest, TestMultiplePermissionRequest) { GURL origin1 = GURL("http://a.google.com"); - int64 resources1 = AwPermissionRequest::Geolocation; + int64_t resources1 = AwPermissionRequest::Geolocation; scoped_ptr<AwPermissionRequestDelegate> delegate1; delegate1.reset(new TestAwPermissionRequestDelegate( @@ -302,7 +298,7 @@ TEST_F(PermissionRequestHandlerTest, TestOriginNotPreauthorized) { // Ask the origin which wasn't preauthorized. GURL origin ("http://a.google.com/a/b"); scoped_ptr<AwPermissionRequestDelegate> delegate; - int64 requested_resources = AwPermissionRequest::AudioCapture; + int64_t requested_resources = AwPermissionRequest::AudioCapture; delegate.reset(new TestAwPermissionRequestDelegate( origin, requested_resources, base::Bind(&PermissionRequestHandlerTest::NotifyRequestResult, @@ -319,8 +315,8 @@ TEST_F(PermissionRequestHandlerTest, TestResourcesNotPreauthorized) { // Ask the resources which weren't preauthorized. scoped_ptr<AwPermissionRequestDelegate> delegate; - int64 requested_resources = AwPermissionRequest::AudioCapture - | AwPermissionRequest::Geolocation; + int64_t requested_resources = + AwPermissionRequest::AudioCapture | AwPermissionRequest::Geolocation; delegate.reset(new TestAwPermissionRequestDelegate( origin(), requested_resources, base::Bind(&PermissionRequestHandlerTest::NotifyRequestResult, diff --git a/android_webview/native/permission/simple_permission_request.cc b/android_webview/native/permission/simple_permission_request.cc index 42ddcb4..d16b9e6 100644 --- a/android_webview/native/permission/simple_permission_request.cc +++ b/android_webview/native/permission/simple_permission_request.cc @@ -11,12 +11,9 @@ namespace android_webview { SimplePermissionRequest::SimplePermissionRequest( const GURL& origin, - int64 resources, + int64_t resources, const base::Callback<void(bool)>& callback) - : origin_(origin), - resources_(resources), - callback_(callback) { -} + : origin_(origin), resources_(resources), callback_(callback) {} SimplePermissionRequest::~SimplePermissionRequest() { } @@ -29,7 +26,7 @@ const GURL& SimplePermissionRequest::GetOrigin() { return origin_; } -int64 SimplePermissionRequest::GetResources() { +int64_t SimplePermissionRequest::GetResources() { return resources_; } diff --git a/android_webview/native/permission/simple_permission_request.h b/android_webview/native/permission/simple_permission_request.h index ba6b870..e1fe00d 100644 --- a/android_webview/native/permission/simple_permission_request.h +++ b/android_webview/native/permission/simple_permission_request.h @@ -5,8 +5,11 @@ #ifndef ANDROID_WEBVIEW_NATIVE_PERMISSION_SIMPLE_PERMISSION_REQUEST_H #define ANDROID_WEBVIEW_NATIVE_PERMISSION_SIMPLE_PERMISSION_REQUEST_H +#include <stdint.h> + #include "android_webview/native/permission/aw_permission_request_delegate.h" #include "base/callback.h" +#include "base/macros.h" namespace android_webview { @@ -15,18 +18,18 @@ namespace android_webview { class SimplePermissionRequest : public AwPermissionRequestDelegate { public: SimplePermissionRequest(const GURL& origin, - int64 resources, + int64_t resources, const base::Callback<void(bool)>& callback); ~SimplePermissionRequest() override; // AwPermissionRequestDelegate implementation. const GURL& GetOrigin() override; - int64 GetResources() override; + int64_t GetResources() override; void NotifyRequestResult(bool allowed) override; private: const GURL origin_; - int64 resources_; + int64_t resources_; const base::Callback<void(bool)> callback_; DISALLOW_COPY_AND_ASSIGN(SimplePermissionRequest); diff --git a/android_webview/native/state_serializer.cc b/android_webview/native/state_serializer.cc index fc9cf9b..65eceb3 100644 --- a/android_webview/native/state_serializer.cc +++ b/android_webview/native/state_serializer.cc @@ -34,7 +34,7 @@ namespace { // Sanity check value that we are restoring from a valid pickle. // This can potentially used as an actual serialization version number in the // future if we ever decide to support restoring from older versions. -const uint32 AW_STATE_VERSION = 20151204; +const uint32_t AW_STATE_VERSION = 20151204; } // namespace @@ -140,7 +140,7 @@ bool WriteHeaderToPickle(base::Pickle* pickle) { } bool RestoreHeaderFromPickle(base::PickleIterator* iterator) { - uint32 state_version = -1; + uint32_t state_version = -1; if (!iterator->ReadUInt32(&state_version)) return false; @@ -294,7 +294,7 @@ bool RestoreNavigationEntryFromPickle(base::PickleIterator* iterator, } { - int64 timestamp; + int64_t timestamp; if (!iterator->ReadInt64(×tamp)) return false; entry->SetTimestamp(base::Time::FromInternalValue(timestamp)); |