| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/permissions/mock_permission_request.h" | 5 #include "chrome/browser/permissions/mock_permission_request.h" |
| 6 | 6 |
| 7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 | 9 |
| 10 #if defined(OS_ANDROID) | 10 #if defined(OS_ANDROID) |
| 11 #include "chrome/browser/android/android_theme_resources.h" | 11 #include "chrome/browser/android/android_theme_resources.h" |
| 12 #else | 12 #else |
| 13 #include "ui/vector_icons/vector_icons.h" | 13 #include "ui/vector_icons/vector_icons.h" |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 MockPermissionRequest::MockPermissionRequest() | 16 MockPermissionRequest::MockPermissionRequest() |
| 17 : MockPermissionRequest("test", | 17 : MockPermissionRequest("test", |
| 18 "button", | 18 "button", |
| 19 "button", | 19 "button", |
| 20 GURL("http://www.google.com"), | 20 GURL("http://www.google.com"), |
| 21 PermissionRequestType::UNKNOWN, | 21 PermissionRequestType::PERMISSION_NOTIFICATIONS, |
| 22 PermissionRequestGestureType::UNKNOWN) {} | 22 PermissionRequestGestureType::UNKNOWN) {} |
| 23 | 23 |
| 24 MockPermissionRequest::MockPermissionRequest( | 24 MockPermissionRequest::MockPermissionRequest(const std::string& text) |
| 25 const std::string& text) | |
| 26 : MockPermissionRequest(text, | 25 : MockPermissionRequest(text, |
| 27 "button", | 26 "button", |
| 28 "button", | 27 "button", |
| 29 GURL("http://www.google.com"), | 28 GURL("http://www.google.com"), |
| 30 PermissionRequestType::UNKNOWN, | 29 PermissionRequestType::PERMISSION_NOTIFICATIONS, |
| 31 PermissionRequestGestureType::UNKNOWN) {} | 30 PermissionRequestGestureType::UNKNOWN) {} |
| 32 | 31 |
| 33 MockPermissionRequest::MockPermissionRequest( | 32 MockPermissionRequest::MockPermissionRequest( |
| 34 const std::string& text, | 33 const std::string& text, |
| 35 PermissionRequestType request_type, | 34 PermissionRequestType request_type, |
| 36 PermissionRequestGestureType gesture_type) | 35 PermissionRequestGestureType gesture_type) |
| 37 : MockPermissionRequest(text, | 36 : MockPermissionRequest(text, |
| 38 "button", | 37 "button", |
| 39 "button", | 38 "button", |
| 40 GURL("http://www.google.com"), | 39 GURL("http://www.google.com"), |
| 41 request_type, | 40 request_type, |
| 42 gesture_type) {} | 41 gesture_type) {} |
| 43 | 42 |
| 44 MockPermissionRequest::MockPermissionRequest(const std::string& text, | 43 MockPermissionRequest::MockPermissionRequest(const std::string& text, |
| 45 PermissionRequestType request_type, | 44 PermissionRequestType request_type, |
| 46 const GURL& url) | 45 const GURL& url) |
| 47 : MockPermissionRequest(text, | 46 : MockPermissionRequest(text, |
| 48 "button", | 47 "button", |
| 49 "button", | 48 "button", |
| 50 url, | 49 url, |
| 51 request_type, | 50 request_type, |
| 52 PermissionRequestGestureType::UNKNOWN) {} | 51 PermissionRequestGestureType::UNKNOWN) {} |
| 53 | 52 |
| 54 MockPermissionRequest::MockPermissionRequest( | 53 MockPermissionRequest::MockPermissionRequest(const std::string& text, |
| 55 const std::string& text, | 54 const std::string& accept_label, |
| 56 const std::string& accept_label, | 55 const std::string& deny_label) |
| 57 const std::string& deny_label) | |
| 58 : MockPermissionRequest(text, | 56 : MockPermissionRequest(text, |
| 59 accept_label, | 57 accept_label, |
| 60 deny_label, | 58 deny_label, |
| 61 GURL("http://www.google.com"), | 59 GURL("http://www.google.com"), |
| 62 PermissionRequestType::UNKNOWN, | 60 PermissionRequestType::PERMISSION_NOTIFICATIONS, |
| 63 PermissionRequestGestureType::UNKNOWN) {} | 61 PermissionRequestGestureType::UNKNOWN) {} |
| 64 | 62 |
| 65 MockPermissionRequest::~MockPermissionRequest() {} | 63 MockPermissionRequest::~MockPermissionRequest() {} |
| 66 | 64 |
| 67 PermissionRequest::IconId MockPermissionRequest::GetIconId() const { | 65 PermissionRequest::IconId MockPermissionRequest::GetIconId() const { |
| 68 // Use a valid icon ID to support UI tests. | 66 // Use a valid icon ID to support UI tests. |
| 69 #if defined(OS_ANDROID) | 67 #if defined(OS_ANDROID) |
| 70 return IDR_ANDROID_INFOBAR_WARNING; | 68 return IDR_ANDROID_INFOBAR_WARNING; |
| 71 #else | 69 #else |
| 72 return ui::kWarningIcon; | 70 return ui::kWarningIcon; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 : granted_(false), | 134 : granted_(false), |
| 137 cancelled_(false), | 135 cancelled_(false), |
| 138 finished_(false), | 136 finished_(false), |
| 139 request_type_(request_type), | 137 request_type_(request_type), |
| 140 gesture_type_(gesture_type) { | 138 gesture_type_(gesture_type) { |
| 141 text_ = base::UTF8ToUTF16(text); | 139 text_ = base::UTF8ToUTF16(text); |
| 142 accept_label_ = base::UTF8ToUTF16(accept_label); | 140 accept_label_ = base::UTF8ToUTF16(accept_label); |
| 143 deny_label_ = base::UTF8ToUTF16(deny_label); | 141 deny_label_ = base::UTF8ToUTF16(deny_label); |
| 144 origin_ = origin.GetOrigin(); | 142 origin_ = origin.GetOrigin(); |
| 145 } | 143 } |
| OLD | NEW |