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 |
| 10 #if defined(OS_ANDROID) |
| 11 #include "chrome/browser/android/android_theme_resources.h" |
| 12 #else |
9 #include "ui/vector_icons/vector_icons.h" | 13 #include "ui/vector_icons/vector_icons.h" |
| 14 #endif |
10 | 15 |
11 MockPermissionRequest::MockPermissionRequest() | 16 MockPermissionRequest::MockPermissionRequest() |
12 : MockPermissionRequest("test", | 17 : MockPermissionRequest("test", |
13 "button", | 18 "button", |
14 "button", | 19 "button", |
15 GURL("http://www.google.com"), | 20 GURL("http://www.google.com"), |
16 PermissionRequestType::UNKNOWN, | 21 PermissionRequestType::UNKNOWN, |
17 PermissionRequestGestureType::UNKNOWN) {} | 22 PermissionRequestGestureType::UNKNOWN) {} |
18 | 23 |
19 MockPermissionRequest::MockPermissionRequest( | 24 MockPermissionRequest::MockPermissionRequest( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 accept_label, | 59 accept_label, |
55 deny_label, | 60 deny_label, |
56 GURL("http://www.google.com"), | 61 GURL("http://www.google.com"), |
57 PermissionRequestType::UNKNOWN, | 62 PermissionRequestType::UNKNOWN, |
58 PermissionRequestGestureType::UNKNOWN) {} | 63 PermissionRequestGestureType::UNKNOWN) {} |
59 | 64 |
60 MockPermissionRequest::~MockPermissionRequest() {} | 65 MockPermissionRequest::~MockPermissionRequest() {} |
61 | 66 |
62 PermissionRequest::IconId MockPermissionRequest::GetIconId() const { | 67 PermissionRequest::IconId MockPermissionRequest::GetIconId() const { |
63 // Use a valid icon ID to support UI tests. | 68 // Use a valid icon ID to support UI tests. |
| 69 #if defined(OS_ANDROID) |
| 70 return IDR_ANDROID_INFOBAR_WARNING; |
| 71 #else |
64 return ui::kWarningIcon; | 72 return ui::kWarningIcon; |
| 73 #endif |
65 } | 74 } |
66 | 75 |
| 76 #if defined(OS_ANDROID) |
| 77 base::string16 MockPermissionRequest::GetMessageText() const { |
| 78 return text_; |
| 79 } |
| 80 #endif |
| 81 |
67 base::string16 MockPermissionRequest::GetMessageTextFragment() const { | 82 base::string16 MockPermissionRequest::GetMessageTextFragment() const { |
68 return text_; | 83 return text_; |
69 } | 84 } |
70 | 85 |
71 GURL MockPermissionRequest::GetOrigin() const { | 86 GURL MockPermissionRequest::GetOrigin() const { |
72 return origin_; | 87 return origin_; |
73 } | 88 } |
74 | 89 |
75 void MockPermissionRequest::PermissionGranted() { | 90 void MockPermissionRequest::PermissionGranted() { |
76 granted_ = true; | 91 granted_ = true; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 : granted_(false), | 136 : granted_(false), |
122 cancelled_(false), | 137 cancelled_(false), |
123 finished_(false), | 138 finished_(false), |
124 request_type_(request_type), | 139 request_type_(request_type), |
125 gesture_type_(gesture_type) { | 140 gesture_type_(gesture_type) { |
126 text_ = base::UTF8ToUTF16(text); | 141 text_ = base::UTF8ToUTF16(text); |
127 accept_label_ = base::UTF8ToUTF16(accept_label); | 142 accept_label_ = base::UTF8ToUTF16(accept_label); |
128 deny_label_ = base::UTF8ToUTF16(deny_label); | 143 deny_label_ = base::UTF8ToUTF16(deny_label); |
129 origin_ = origin.GetOrigin(); | 144 origin_ = origin.GetOrigin(); |
130 } | 145 } |
OLD | NEW |