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