| 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 30 matching lines...) Expand all Loading... |
| 41 #include "components/user_prefs/user_prefs.h" | 41 #include "components/user_prefs/user_prefs.h" |
| 42 #include "content/public/browser/notification_service.h" | 42 #include "content/public/browser/notification_service.h" |
| 43 #include "content/public/browser/web_contents.h" | 43 #include "content/public/browser/web_contents.h" |
| 44 #include "content/public/browser/web_contents_view.h" | 44 #include "content/public/browser/web_contents_view.h" |
| 45 #include "extensions/browser/event_router.h" | 45 #include "extensions/browser/event_router.h" |
| 46 #include "extensions/browser/extension_system.h" | 46 #include "extensions/browser/extension_system.h" |
| 47 #include "extensions/browser/quota_service.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) |
| 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; |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 GetAssociatedWebContents(); | 939 GetAssociatedWebContents(); |
| 940 | 940 |
| 941 select_file_dialog_ = ui::SelectFileDialog::Create( | 941 select_file_dialog_ = ui::SelectFileDialog::Create( |
| 942 this, new ChromeSelectFilePolicy(web_contents)); | 942 this, new ChromeSelectFilePolicy(web_contents)); |
| 943 ui::SelectFileDialog::FileTypeInfo file_type_info; | 943 ui::SelectFileDialog::FileTypeInfo file_type_info; |
| 944 file_type_info.extensions.resize(1); | 944 file_type_info.extensions.resize(1); |
| 945 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); | 945 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); |
| 946 gfx::NativeWindow owning_window = web_contents ? | 946 gfx::NativeWindow owning_window = web_contents ? |
| 947 platform_util::GetTopLevel(web_contents->GetView()->GetNativeView()) | 947 platform_util::GetTopLevel(web_contents->GetView()->GetNativeView()) |
| 948 : NULL; | 948 : NULL; |
| 949 #if defined(OS_WIN) && defined(USE_AURA) | 949 #if defined(OS_WIN) |
| 950 if (!owning_window && | 950 if (!owning_window && |
| 951 chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) | 951 chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 952 owning_window = aura::RemoteWindowTreeHostWin::Instance()->GetAshWindow(); | 952 owning_window = aura::RemoteWindowTreeHostWin::Instance()->GetAshWindow(); |
| 953 #endif | 953 #endif |
| 954 // |web_contents| can be NULL (for background pages), which is fine. In such | 954 // |web_contents| can be NULL (for background pages), which is fine. In such |
| 955 // a case if file-selection dialogs are forbidden by policy, we will not | 955 // a case if file-selection dialogs are forbidden by policy, we will not |
| 956 // show an InfoBar, which is better than letting one appear out of the blue. | 956 // show an InfoBar, which is better than letting one appear out of the blue. |
| 957 select_file_dialog_->SelectFile(type, | 957 select_file_dialog_->SelectFile(type, |
| 958 base::string16(), | 958 base::string16(), |
| 959 default_path, | 959 default_path, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 #if !defined(OS_ANDROID) | 1015 #if !defined(OS_ANDROID) |
| 1016 // Android does not have support for the standard exporter. | 1016 // Android does not have support for the standard exporter. |
| 1017 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 1017 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
| 1018 // Android. | 1018 // Android. |
| 1019 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); | 1019 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); |
| 1020 #endif | 1020 #endif |
| 1021 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 1021 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 } // namespace extensions | 1024 } // namespace extensions |
| OLD | NEW |