| 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/ui/website_settings/mock_permission_bubble_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 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
| 10 | 10 |
| 11 MockPermissionBubbleRequest::MockPermissionBubbleRequest() | 11 MockPermissionRequest::MockPermissionRequest() |
| 12 : MockPermissionBubbleRequest("test", | 12 : MockPermissionRequest("test", |
| 13 "button", | 13 "button", |
| 14 "button", | 14 "button", |
| 15 GURL("http://www.google.com"), | 15 GURL("http://www.google.com"), |
| 16 PermissionBubbleType::UNKNOWN) {} | 16 PermissionRequestType::UNKNOWN) {} |
| 17 | 17 |
| 18 MockPermissionBubbleRequest::MockPermissionBubbleRequest( | 18 MockPermissionRequest::MockPermissionRequest( |
| 19 const std::string& text) | 19 const std::string& text) |
| 20 : MockPermissionBubbleRequest(text, | 20 : MockPermissionRequest(text, |
| 21 "button", | 21 "button", |
| 22 "button", | 22 "button", |
| 23 GURL("http://www.google.com"), | 23 GURL("http://www.google.com"), |
| 24 PermissionBubbleType::UNKNOWN) {} | 24 PermissionRequestType::UNKNOWN) {} |
| 25 | 25 |
| 26 MockPermissionBubbleRequest::MockPermissionBubbleRequest( | 26 MockPermissionRequest::MockPermissionRequest( |
| 27 const std::string& text, PermissionBubbleType bubble_type) | 27 const std::string& text, PermissionRequestType request_type) |
| 28 : MockPermissionBubbleRequest(text, | 28 : MockPermissionRequest(text, |
| 29 "button", | 29 "button", |
| 30 "button", | 30 "button", |
| 31 GURL("http://www.google.com"), | 31 GURL("http://www.google.com"), |
| 32 bubble_type) {} | 32 request_type) {} |
| 33 | 33 |
| 34 MockPermissionBubbleRequest::MockPermissionBubbleRequest( | 34 MockPermissionRequest::MockPermissionRequest( |
| 35 const std::string& text, | 35 const std::string& text, |
| 36 const GURL& url) | 36 const GURL& url) |
| 37 : MockPermissionBubbleRequest(text, | 37 : MockPermissionRequest(text, |
| 38 "button", | 38 "button", |
| 39 "button", | 39 "button", |
| 40 url, | 40 url, |
| 41 PermissionBubbleType::UNKNOWN) {} | 41 PermissionRequestType::UNKNOWN) {} |
| 42 | 42 |
| 43 MockPermissionBubbleRequest::MockPermissionBubbleRequest( | 43 MockPermissionRequest::MockPermissionRequest( |
| 44 const std::string& text, | 44 const std::string& text, |
| 45 const std::string& accept_label, | 45 const std::string& accept_label, |
| 46 const std::string& deny_label) | 46 const std::string& deny_label) |
| 47 : MockPermissionBubbleRequest(text, | 47 : MockPermissionRequest(text, |
| 48 accept_label, | 48 accept_label, |
| 49 deny_label, | 49 deny_label, |
| 50 GURL("http://www.google.com"), | 50 GURL("http://www.google.com"), |
| 51 PermissionBubbleType::UNKNOWN) {} | 51 PermissionRequestType::UNKNOWN) {} |
| 52 | 52 |
| 53 MockPermissionBubbleRequest::~MockPermissionBubbleRequest() {} | 53 MockPermissionRequest::~MockPermissionRequest() {} |
| 54 | 54 |
| 55 int MockPermissionBubbleRequest::GetIconId() const { | 55 int MockPermissionRequest::GetIconId() const { |
| 56 // Use a valid icon ID to support UI tests. | 56 // Use a valid icon ID to support UI tests. |
| 57 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; | 57 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; |
| 58 } | 58 } |
| 59 | 59 |
| 60 base::string16 MockPermissionBubbleRequest::GetMessageTextFragment() const { | 60 base::string16 MockPermissionRequest::GetMessageTextFragment() const { |
| 61 return text_; | 61 return text_; |
| 62 } | 62 } |
| 63 | 63 |
| 64 GURL MockPermissionBubbleRequest::GetOrigin() const { | 64 GURL MockPermissionRequest::GetOrigin() const { |
| 65 return origin_; | 65 return origin_; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void MockPermissionBubbleRequest::PermissionGranted() { | 68 void MockPermissionRequest::PermissionGranted() { |
| 69 granted_ = true; | 69 granted_ = true; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void MockPermissionBubbleRequest::PermissionDenied() { | 72 void MockPermissionRequest::PermissionDenied() { |
| 73 granted_ = false; | 73 granted_ = false; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void MockPermissionBubbleRequest::Cancelled() { | 76 void MockPermissionRequest::Cancelled() { |
| 77 granted_ = false; | 77 granted_ = false; |
| 78 cancelled_ = true; | 78 cancelled_ = true; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void MockPermissionBubbleRequest::RequestFinished() { | 81 void MockPermissionRequest::RequestFinished() { |
| 82 finished_ = true; | 82 finished_ = true; |
| 83 } | 83 } |
| 84 | 84 |
| 85 PermissionBubbleType MockPermissionBubbleRequest::GetPermissionBubbleType() | 85 PermissionRequestType MockPermissionRequest::GetPermissionRequestType() |
| 86 const { | 86 const { |
| 87 return bubble_type_; | 87 return request_type_; |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool MockPermissionBubbleRequest::granted() { | 90 bool MockPermissionRequest::granted() { |
| 91 return granted_; | 91 return granted_; |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool MockPermissionBubbleRequest::cancelled() { | 94 bool MockPermissionRequest::cancelled() { |
| 95 return cancelled_; | 95 return cancelled_; |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool MockPermissionBubbleRequest::finished() { | 98 bool MockPermissionRequest::finished() { |
| 99 return finished_; | 99 return finished_; |
| 100 } | 100 } |
| 101 | 101 |
| 102 MockPermissionBubbleRequest::MockPermissionBubbleRequest( | 102 MockPermissionRequest::MockPermissionRequest( |
| 103 const std::string& text, | 103 const std::string& text, |
| 104 const std::string& accept_label, | 104 const std::string& accept_label, |
| 105 const std::string& deny_label, | 105 const std::string& deny_label, |
| 106 const GURL& origin, | 106 const GURL& origin, |
| 107 PermissionBubbleType bubble_type) | 107 PermissionRequestType request_type) |
| 108 : granted_(false), | 108 : granted_(false), |
| 109 cancelled_(false), | 109 cancelled_(false), |
| 110 finished_(false), | 110 finished_(false), |
| 111 bubble_type_(bubble_type) { | 111 request_type_(request_type) { |
| 112 text_ = base::UTF8ToUTF16(text); | 112 text_ = base::UTF8ToUTF16(text); |
| 113 accept_label_ = base::UTF8ToUTF16(accept_label); | 113 accept_label_ = base::UTF8ToUTF16(accept_label); |
| 114 deny_label_ = base::UTF8ToUTF16(deny_label); | 114 deny_label_ = base::UTF8ToUTF16(deny_label); |
| 115 origin_ = origin.GetOrigin(); | 115 origin_ = origin.GetOrigin(); |
| 116 } | 116 } |
| OLD | NEW |