| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/child/permissions/permission_dispatcher.h" | 5 #include "content/child/permissions/permission_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "content/child/worker_task_runner.h" | 8 #include "content/child/worker_task_runner.h" |
| 9 #include "content/public/common/service_registry.h" | 9 #include "content/public/common/service_registry.h" |
| 10 #include "third_party/WebKit/public/platform/WebURL.h" | 10 #include "third_party/WebKit/public/platform/WebURL.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 case blink::WebPermissionStatusDenied: | 41 case blink::WebPermissionStatusDenied: |
| 42 return PERMISSION_STATUS_DENIED; | 42 return PERMISSION_STATUS_DENIED; |
| 43 case blink::WebPermissionStatusPrompt: | 43 case blink::WebPermissionStatusPrompt: |
| 44 return PERMISSION_STATUS_ASK; | 44 return PERMISSION_STATUS_ASK; |
| 45 } | 45 } |
| 46 | 46 |
| 47 NOTREACHED(); | 47 NOTREACHED(); |
| 48 return PERMISSION_STATUS_DENIED; | 48 return PERMISSION_STATUS_DENIED; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // PERMISSION_STATUS_NUM is only a boundary value and should never be passed |
| 52 // into this function for |status|. |
| 51 blink::WebPermissionStatus GetWebPermissionStatus(PermissionStatus status) { | 53 blink::WebPermissionStatus GetWebPermissionStatus(PermissionStatus status) { |
| 52 switch (status) { | 54 switch (status) { |
| 53 case PERMISSION_STATUS_GRANTED: | 55 case PERMISSION_STATUS_GRANTED: |
| 54 return blink::WebPermissionStatusGranted; | 56 return blink::WebPermissionStatusGranted; |
| 55 case PERMISSION_STATUS_DENIED: | 57 case PERMISSION_STATUS_DENIED: |
| 56 return blink::WebPermissionStatusDenied; | 58 return blink::WebPermissionStatusDenied; |
| 57 case PERMISSION_STATUS_ASK: | 59 case PERMISSION_STATUS_ASK: |
| 58 return blink::WebPermissionStatusPrompt; | 60 return blink::WebPermissionStatusPrompt; |
| 61 case PERMISSION_STATUS_NUM: |
| 62 NOTREACHED(); |
| 63 break; |
| 59 } | 64 } |
| 60 | 65 |
| 61 NOTREACHED(); | |
| 62 return blink::WebPermissionStatusDenied; | 66 return blink::WebPermissionStatusDenied; |
| 63 } | 67 } |
| 64 | 68 |
| 65 const int kNoWorkerThread = 0; | 69 const int kNoWorkerThread = 0; |
| 66 | 70 |
| 67 } // anonymous namespace | 71 } // anonymous namespace |
| 68 | 72 |
| 69 // static | 73 // static |
| 70 bool PermissionDispatcher::IsObservable(blink::WebPermissionType type) { | 74 bool PermissionDispatcher::IsObservable(blink::WebPermissionType type) { |
| 71 return type == blink::WebPermissionTypeGeolocation || | 75 return type == blink::WebPermissionTypeGeolocation || |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 origin, | 281 origin, |
| 278 current_status, | 282 current_status, |
| 279 base::Bind(&PermissionDispatcher::OnPermissionChanged, | 283 base::Bind(&PermissionDispatcher::OnPermissionChanged, |
| 280 base::Unretained(this), | 284 base::Unretained(this), |
| 281 type, | 285 type, |
| 282 origin, | 286 origin, |
| 283 base::Unretained(observer))); | 287 base::Unretained(observer))); |
| 284 } | 288 } |
| 285 | 289 |
| 286 } // namespace content | 290 } // namespace content |
| OLD | NEW |