OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Implements the Chrome Extensions WebNavigation API. | 5 // Implements the Chrome Extensions WebNavigation API. |
6 | 6 |
7 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 7 #include "chrome/browser/extensions/extension_webnavigation_api.h" |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 LAZY_INSTANCE_INITIALIZER; | 42 LAZY_INSTANCE_INITIALIZER; |
43 | 43 |
44 // URL schemes for which we'll send events. | 44 // URL schemes for which we'll send events. |
45 const char* kValidSchemes[] = { | 45 const char* kValidSchemes[] = { |
46 chrome::kHttpScheme, | 46 chrome::kHttpScheme, |
47 chrome::kHttpsScheme, | 47 chrome::kHttpsScheme, |
48 chrome::kFileScheme, | 48 chrome::kFileScheme, |
49 chrome::kFtpScheme, | 49 chrome::kFtpScheme, |
50 chrome::kJavaScriptScheme, | 50 chrome::kJavaScriptScheme, |
51 chrome::kDataScheme, | 51 chrome::kDataScheme, |
| 52 chrome::kFileSystemScheme, |
52 }; | 53 }; |
53 | 54 |
54 // Returns the frame ID as it will be passed to the extension: | 55 // Returns the frame ID as it will be passed to the extension: |
55 // 0 if the navigation happens in the main frame, or the frame ID | 56 // 0 if the navigation happens in the main frame, or the frame ID |
56 // modulo 32 bits otherwise. | 57 // modulo 32 bits otherwise. |
57 // Keep this in sync with the GetFrameId() function in | 58 // Keep this in sync with the GetFrameId() function in |
58 // extension_webrequest_api.cc. | 59 // extension_webrequest_api.cc. |
59 int GetFrameId(bool is_main_frame, int64 frame_id) { | 60 int GetFrameId(bool is_main_frame, int64 frame_id) { |
60 return is_main_frame ? 0 : static_cast<int>(frame_id); | 61 return is_main_frame ? 0 : static_cast<int>(frame_id); |
61 } | 62 } |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 keys::kFrameIdKey, | 800 keys::kFrameIdKey, |
800 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); | 801 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); |
801 frameDict->SetBoolean( | 802 frameDict->SetBoolean( |
802 keys::kErrorOccurredKey, | 803 keys::kErrorOccurredKey, |
803 navigation_state.GetErrorOccurredInFrame(*frame)); | 804 navigation_state.GetErrorOccurredInFrame(*frame)); |
804 resultList->Append(frameDict); | 805 resultList->Append(frameDict); |
805 } | 806 } |
806 result_.reset(resultList); | 807 result_.reset(resultList); |
807 return true; | 808 return true; |
808 } | 809 } |
OLD | NEW |