| 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 "android_webview/native/permission/permission_request_handler.h" | 5 #include "android_webview/native/permission/permission_request_handler.h" |
| 6 | 6 |
| 7 #include "android_webview/native/permission/aw_permission_request.h" | 7 #include "android_webview/native/permission/aw_permission_request.h" |
| 8 #include "android_webview/native/permission/aw_permission_request_delegate.h" | 8 #include "android_webview/native/permission/aw_permission_request_delegate.h" |
| 9 #include "android_webview/native/permission/permission_request_handler_client.h" | 9 #include "android_webview/native/permission/permission_request_handler_client.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 if (key.empty()) { | 75 if (key.empty()) { |
| 76 LOG(ERROR) << "The origin of preauthorization is empty, ignore it."; | 76 LOG(ERROR) << "The origin of preauthorization is empty, ignore it."; |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 | 79 |
| 80 preauthorized_permission_[key] |= resources; | 80 preauthorized_permission_[key] |= resources; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void PermissionRequestHandler::NavigationEntryCommitted( | 83 void PermissionRequestHandler::NavigationEntryCommitted( |
| 84 const content::LoadCommittedDetails& details) { | 84 const content::LoadCommittedDetails& details) { |
| 85 const content::PageTransition transition = details.entry->GetTransitionType(); | 85 const ui::PageTransition transition = details.entry->GetTransitionType(); |
| 86 if (details.is_navigation_to_different_page() || | 86 if (details.is_navigation_to_different_page() || |
| 87 content::PageTransitionStripQualifier(transition) == | 87 ui::PageTransitionStripQualifier(transition) == |
| 88 content::PAGE_TRANSITION_RELOAD || | 88 ui::PAGE_TRANSITION_RELOAD || |
| 89 contents_unique_id_ != details.entry->GetUniqueID()) { | 89 contents_unique_id_ != details.entry->GetUniqueID()) { |
| 90 CancelAllRequests(); | 90 CancelAllRequests(); |
| 91 contents_unique_id_ = details.entry->GetUniqueID(); | 91 contents_unique_id_ = details.entry->GetUniqueID(); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 PermissionRequestHandler::RequestIterator | 95 PermissionRequestHandler::RequestIterator |
| 96 PermissionRequestHandler::FindRequest(const GURL& origin, | 96 PermissionRequestHandler::FindRequest(const GURL& origin, |
| 97 int64 resources) { | 97 int64 resources) { |
| 98 RequestIterator i; | 98 RequestIterator i; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 bool PermissionRequestHandler::Preauthorized(const GURL& origin, | 132 bool PermissionRequestHandler::Preauthorized(const GURL& origin, |
| 133 int64 resources) { | 133 int64 resources) { |
| 134 std::map<std::string, int64>::iterator i = | 134 std::map<std::string, int64>::iterator i = |
| 135 preauthorized_permission_.find(origin.GetOrigin().spec()); | 135 preauthorized_permission_.find(origin.GetOrigin().spec()); |
| 136 | 136 |
| 137 return i != preauthorized_permission_.end() && | 137 return i != preauthorized_permission_.end() && |
| 138 (resources & i->second) == resources; | 138 (resources & i->second) == resources; |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace android_webivew | 141 } // namespace android_webivew |
| OLD | NEW |