| 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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 BucketMapper* short_mapper, BucketMapper* long_mapper) { | 807 BucketMapper* short_mapper, BucketMapper* long_mapper) { |
| 808 const Config kShortLimitConfig = { | 808 const Config kShortLimitConfig = { |
| 809 2, // 2 tokens per interval. | 809 2, // 2 tokens per interval. |
| 810 TimeDelta::FromMinutes(1) // 1 minute long refill interval. | 810 TimeDelta::FromMinutes(1) // 1 minute long refill interval. |
| 811 }; | 811 }; |
| 812 const Config kLongLimitConfig = { | 812 const Config kLongLimitConfig = { |
| 813 100, // 100 tokens per interval. | 813 100, // 100 tokens per interval. |
| 814 TimeDelta::FromHours(1) // 1 hour long refill interval. | 814 TimeDelta::FromHours(1) // 1 hour long refill interval. |
| 815 }; | 815 }; |
| 816 | 816 |
| 817 TimedLimit* timed = new TimedLimit(kLongLimitConfig, long_mapper); | 817 TimedLimit* timed = new TimedLimit( |
| 818 kLongLimitConfig, |
| 819 long_mapper, |
| 820 "operations per minute"); |
| 818 // A max of two operations per minute, sustained over 10 minutes. | 821 // A max of two operations per minute, sustained over 10 minutes. |
| 819 SustainedLimit* sustained = new SustainedLimit(TimeDelta::FromMinutes(10), | 822 SustainedLimit* sustained = new SustainedLimit( |
| 820 kShortLimitConfig, short_mapper); | 823 TimeDelta::FromMinutes(10), |
| 824 kShortLimitConfig, |
| 825 short_mapper, |
| 826 "sustained operations per 10 minutes"); |
| 821 heuristics->push_back(timed); | 827 heuristics->push_back(timed); |
| 822 heuristics->push_back(sustained); | 828 heuristics->push_back(sustained); |
| 823 } | 829 } |
| 824 | 830 |
| 825 DISALLOW_IMPLICIT_CONSTRUCTORS(BookmarksQuotaLimitFactory); | 831 DISALLOW_IMPLICIT_CONSTRUCTORS(BookmarksQuotaLimitFactory); |
| 826 }; | 832 }; |
| 827 | 833 |
| 828 // And finally, building the individual heuristics for each function. | 834 // And finally, building the individual heuristics for each function. |
| 829 void RemoveBookmarkFunction::GetQuotaLimitHeuristics( | 835 void RemoveBookmarkFunction::GetQuotaLimitHeuristics( |
| 830 QuotaLimitHeuristics* heuristics) const { | 836 QuotaLimitHeuristics* heuristics) const { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 int index, | 958 int index, |
| 953 void* params) { | 959 void* params) { |
| 954 #if !defined(OS_ANDROID) | 960 #if !defined(OS_ANDROID) |
| 955 // Android does not have support for the standard exporter. | 961 // Android does not have support for the standard exporter. |
| 956 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 962 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
| 957 // Android. | 963 // Android. |
| 958 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); | 964 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); |
| 959 #endif | 965 #endif |
| 960 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 966 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 961 } | 967 } |
| OLD | NEW |