OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 24 matching lines...) Expand all Loading... |
35 LAZY_INSTANCE_INITIALIZER; | 35 LAZY_INSTANCE_INITIALIZER; |
36 | 36 |
37 // URL schemes for which we'll send events. | 37 // URL schemes for which we'll send events. |
38 const char* kValidSchemes[] = { | 38 const char* kValidSchemes[] = { |
39 chrome::kHttpScheme, | 39 chrome::kHttpScheme, |
40 chrome::kHttpsScheme, | 40 chrome::kHttpsScheme, |
41 chrome::kFileScheme, | 41 chrome::kFileScheme, |
42 chrome::kFtpScheme, | 42 chrome::kFtpScheme, |
43 chrome::kJavaScriptScheme, | 43 chrome::kJavaScriptScheme, |
44 chrome::kDataScheme, | 44 chrome::kDataScheme, |
| 45 chrome::kFileSystemScheme, |
45 }; | 46 }; |
46 | 47 |
47 // Returns the frame ID as it will be passed to the extension: | 48 // Returns the frame ID as it will be passed to the extension: |
48 // 0 if the navigation happens in the main frame, or the frame ID | 49 // 0 if the navigation happens in the main frame, or the frame ID |
49 // modulo 32 bits otherwise. | 50 // modulo 32 bits otherwise. |
50 // Keep this in sync with the GetFrameId() function in | 51 // Keep this in sync with the GetFrameId() function in |
51 // extension_webrequest_api.cc. | 52 // extension_webrequest_api.cc. |
52 int GetFrameId(bool is_main_frame, int64 frame_id) { | 53 int GetFrameId(bool is_main_frame, int64 frame_id) { |
53 return is_main_frame ? 0 : static_cast<int>(frame_id); | 54 return is_main_frame ? 0 : static_cast<int>(frame_id); |
54 } | 55 } |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 keys::kFrameIdKey, | 740 keys::kFrameIdKey, |
740 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); | 741 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); |
741 frameDict->SetBoolean( | 742 frameDict->SetBoolean( |
742 keys::kErrorOccurredKey, | 743 keys::kErrorOccurredKey, |
743 navigation_state.GetErrorOccurredInFrame(*frame)); | 744 navigation_state.GetErrorOccurredInFrame(*frame)); |
744 resultList->Append(frameDict); | 745 resultList->Append(frameDict); |
745 } | 746 } |
746 result_.reset(resultList); | 747 result_.reset(resultList); |
747 return true; | 748 return true; |
748 } | 749 } |
OLD | NEW |