| 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/extensions/api/bookmarks/bookmarks_api.h" | 5 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/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 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/bookmarks/bookmark_html_writer.h" | 23 #include "chrome/browser/bookmarks/bookmark_html_writer.h" |
| 24 #include "chrome/browser/bookmarks/bookmark_model.h" | 24 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 25 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 25 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 26 #include "chrome/browser/bookmarks/bookmark_utils.h" | 26 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 27 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
| 28 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_constants.h" | 28 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_constants.h" |
| 29 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.h" | 29 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.h" |
| 30 #include "chrome/browser/extensions/event_router.h" | 30 #include "chrome/browser/extensions/event_router.h" |
| 31 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 31 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 32 #include "chrome/browser/extensions/extension_system.h" | 32 #include "chrome/browser/extensions/extension_system.h" |
| 33 #include "chrome/browser/extensions/extensions_quota_service.h" | |
| 34 #include "chrome/browser/importer/external_process_importer_host.h" | 33 #include "chrome/browser/importer/external_process_importer_host.h" |
| 35 #include "chrome/browser/importer/importer_uma.h" | 34 #include "chrome/browser/importer/importer_uma.h" |
| 36 #include "chrome/browser/platform_util.h" | 35 #include "chrome/browser/platform_util.h" |
| 37 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
| 38 #include "chrome/browser/ui/chrome_select_file_policy.h" | 37 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 39 #include "chrome/browser/ui/host_desktop.h" | 38 #include "chrome/browser/ui/host_desktop.h" |
| 40 #include "chrome/common/chrome_paths.h" | 39 #include "chrome/common/chrome_paths.h" |
| 41 #include "chrome/common/extensions/api/bookmarks.h" | 40 #include "chrome/common/extensions/api/bookmarks.h" |
| 42 #include "chrome/common/importer/importer_data_types.h" | 41 #include "chrome/common/importer/importer_data_types.h" |
| 43 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
| 44 #include "components/user_prefs/user_prefs.h" | 43 #include "components/user_prefs/user_prefs.h" |
| 45 #include "content/public/browser/notification_service.h" | 44 #include "content/public/browser/notification_service.h" |
| 46 #include "content/public/browser/web_contents.h" | 45 #include "content/public/browser/web_contents.h" |
| 47 #include "content/public/browser/web_contents_view.h" | 46 #include "content/public/browser/web_contents_view.h" |
| 47 #include "extensions/browser/quota_service.h" |
| 48 #include "grit/generated_resources.h" | 48 #include "grit/generated_resources.h" |
| 49 #include "ui/base/l10n/l10n_util.h" | 49 #include "ui/base/l10n/l10n_util.h" |
| 50 | 50 |
| 51 #if defined(OS_WIN) && defined(USE_AURA) | 51 #if defined(OS_WIN) && defined(USE_AURA) |
| 52 #include "ui/aura/remote_root_window_host_win.h" | 52 #include "ui/aura/remote_root_window_host_win.h" |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 namespace extensions { | 55 namespace extensions { |
| 56 | 56 |
| 57 namespace keys = bookmark_api_constants; | 57 namespace keys = bookmark_api_constants; |
| 58 namespace bookmarks = api::bookmarks; | 58 namespace bookmarks = api::bookmarks; |
| 59 | 59 |
| 60 using base::TimeDelta; | 60 using base::TimeDelta; |
| 61 using bookmarks::BookmarkTreeNode; | 61 using bookmarks::BookmarkTreeNode; |
| 62 using content::BrowserThread; | 62 using content::BrowserThread; |
| 63 using content::WebContents; | 63 using content::WebContents; |
| 64 | 64 |
| 65 typedef QuotaLimitHeuristic::Bucket Bucket; | 65 typedef QuotaLimitHeuristic::Bucket Bucket; |
| 66 typedef QuotaLimitHeuristic::Config Config; | 66 typedef QuotaLimitHeuristic::Config Config; |
| 67 typedef QuotaLimitHeuristic::BucketList BucketList; | 67 typedef QuotaLimitHeuristic::BucketList BucketList; |
| 68 typedef ExtensionsQuotaService::TimedLimit TimedLimit; | 68 typedef QuotaService::TimedLimit TimedLimit; |
| 69 typedef ExtensionsQuotaService::SustainedLimit SustainedLimit; | 69 typedef QuotaService::SustainedLimit SustainedLimit; |
| 70 typedef QuotaLimitHeuristic::BucketMapper BucketMapper; | 70 typedef QuotaLimitHeuristic::BucketMapper BucketMapper; |
| 71 | 71 |
| 72 namespace { | 72 namespace { |
| 73 | 73 |
| 74 // Generates a default path (including a default filename) that will be | 74 // Generates a default path (including a default filename) that will be |
| 75 // used for pre-populating the "Export Bookmarks" file chooser dialog box. | 75 // used for pre-populating the "Export Bookmarks" file chooser dialog box. |
| 76 base::FilePath GetDefaultFilepathForBookmarkExport() { | 76 base::FilePath GetDefaultFilepathForBookmarkExport() { |
| 77 base::Time time = base::Time::Now(); | 77 base::Time time = base::Time::Now(); |
| 78 | 78 |
| 79 // Concatenate a date stamp to the filename. | 79 // Concatenate a date stamp to the filename. |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 #if !defined(OS_ANDROID) | 990 #if !defined(OS_ANDROID) |
| 991 // Android does not have support for the standard exporter. | 991 // Android does not have support for the standard exporter. |
| 992 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 992 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
| 993 // Android. | 993 // Android. |
| 994 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); | 994 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); |
| 995 #endif | 995 #endif |
| 996 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 996 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 997 } | 997 } |
| 998 | 998 |
| 999 } // namespace extensions | 999 } // namespace extensions |
| OLD | NEW |