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 30 matching lines...) Expand all Loading... |
41 LAZY_INSTANCE_INITIALIZER; | 41 LAZY_INSTANCE_INITIALIZER; |
42 | 42 |
43 // URL schemes for which we'll send events. | 43 // URL schemes for which we'll send events. |
44 const char* kValidSchemes[] = { | 44 const char* kValidSchemes[] = { |
45 chrome::kHttpScheme, | 45 chrome::kHttpScheme, |
46 chrome::kHttpsScheme, | 46 chrome::kHttpsScheme, |
47 chrome::kFileScheme, | 47 chrome::kFileScheme, |
48 chrome::kFtpScheme, | 48 chrome::kFtpScheme, |
49 chrome::kJavaScriptScheme, | 49 chrome::kJavaScriptScheme, |
50 chrome::kDataScheme, | 50 chrome::kDataScheme, |
| 51 chrome::kFileSystemScheme, |
51 }; | 52 }; |
52 | 53 |
53 // Returns the frame ID as it will be passed to the extension: | 54 // Returns the frame ID as it will be passed to the extension: |
54 // 0 if the navigation happens in the main frame, or the frame ID | 55 // 0 if the navigation happens in the main frame, or the frame ID |
55 // modulo 32 bits otherwise. | 56 // modulo 32 bits otherwise. |
56 // Keep this in sync with the GetFrameId() function in | 57 // Keep this in sync with the GetFrameId() function in |
57 // extension_webrequest_api.cc. | 58 // extension_webrequest_api.cc. |
58 int GetFrameId(bool is_main_frame, int64 frame_id) { | 59 int GetFrameId(bool is_main_frame, int64 frame_id) { |
59 return is_main_frame ? 0 : static_cast<int>(frame_id); | 60 return is_main_frame ? 0 : static_cast<int>(frame_id); |
60 } | 61 } |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 keys::kFrameIdKey, | 799 keys::kFrameIdKey, |
799 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); | 800 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); |
800 frameDict->SetBoolean( | 801 frameDict->SetBoolean( |
801 keys::kErrorOccurredKey, | 802 keys::kErrorOccurredKey, |
802 navigation_state.GetErrorOccurredInFrame(*frame)); | 803 navigation_state.GetErrorOccurredInFrame(*frame)); |
803 resultList->Append(frameDict); | 804 resultList->Append(frameDict); |
804 } | 805 } |
805 result_.reset(resultList); | 806 result_.reset(resultList); |
806 return true; | 807 return true; |
807 } | 808 } |
OLD | NEW |