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 #include "chrome/browser/bookmarks/bookmark_extension_api.h" | 5 #include "chrome/browser/bookmarks/bookmark_extension_api.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/i18n/file_util_icu.h" | 9 #include "base/i18n/file_util_icu.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
37 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
38 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
39 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
40 | 40 |
41 namespace keys = bookmark_extension_api_constants; | 41 namespace keys = bookmark_extension_api_constants; |
42 | 42 |
43 using base::TimeDelta; | 43 using base::TimeDelta; |
44 using content::BrowserThread; | 44 using content::BrowserThread; |
45 using content::WebContents; | 45 using content::WebContents; |
| 46 |
46 typedef QuotaLimitHeuristic::Bucket Bucket; | 47 typedef QuotaLimitHeuristic::Bucket Bucket; |
47 typedef QuotaLimitHeuristic::Config Config; | 48 typedef QuotaLimitHeuristic::Config Config; |
48 typedef QuotaLimitHeuristic::BucketList BucketList; | 49 typedef QuotaLimitHeuristic::BucketList BucketList; |
49 typedef ExtensionsQuotaService::TimedLimit TimedLimit; | 50 typedef ExtensionsQuotaService::TimedLimit TimedLimit; |
50 typedef ExtensionsQuotaService::SustainedLimit SustainedLimit; | 51 typedef ExtensionsQuotaService::SustainedLimit SustainedLimit; |
51 typedef QuotaLimitHeuristic::BucketMapper BucketMapper; | 52 typedef QuotaLimitHeuristic::BucketMapper BucketMapper; |
52 | 53 |
53 namespace { | 54 namespace { |
54 | 55 |
55 // Generates a default path (including a default filename) that will be | 56 // Generates a default path (including a default filename) that will be |
(...skipping 29 matching lines...) Expand all Loading... |
85 this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, | 86 this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, |
86 content::NotificationService::AllBrowserContextsAndSources()); | 87 content::NotificationService::AllBrowserContextsAndSources()); |
87 AddRef(); // Balanced in Observe(). | 88 AddRef(); // Balanced in Observe(). |
88 return; | 89 return; |
89 } | 90 } |
90 | 91 |
91 bool success = RunImpl(); | 92 bool success = RunImpl(); |
92 if (success) { | 93 if (success) { |
93 content::NotificationService::current()->Notify( | 94 content::NotificationService::current()->Notify( |
94 chrome::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, | 95 chrome::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, |
95 content::Source<const Extension>(GetExtension()), | 96 content::Source<const extensions::Extension>(GetExtension()), |
96 content::Details<const BookmarksFunction>(this)); | 97 content::Details<const BookmarksFunction>(this)); |
97 } | 98 } |
98 SendResponse(success); | 99 SendResponse(success); |
99 } | 100 } |
100 | 101 |
101 bool BookmarksFunction::GetBookmarkIdAsInt64( | 102 bool BookmarksFunction::GetBookmarkIdAsInt64( |
102 const std::string& id_string, int64* id) { | 103 const std::string& id_string, int64* id) { |
103 if (base::StringToInt64(id_string, id)) | 104 if (base::StringToInt64(id_string, id)) |
104 return true; | 105 return true; |
105 | 106 |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 int index, | 943 int index, |
943 void* params) { | 944 void* params) { |
944 #if !defined(OS_ANDROID) | 945 #if !defined(OS_ANDROID) |
945 // Android does not have support for the standard exporter. | 946 // Android does not have support for the standard exporter. |
946 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 947 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
947 // Android. | 948 // Android. |
948 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); | 949 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); |
949 #endif | 950 #endif |
950 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 951 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
951 } | 952 } |
OLD | NEW |