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/bookmark_manager_private/bookmark_manage
r_private_api.h" | 5 #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage
r_private_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/bookmarks/bookmark_model.h" | 13 #include "chrome/browser/bookmarks/bookmark_model.h" |
14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
15 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 15 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
16 #include "chrome/browser/bookmarks/bookmark_utils.h" | 16 #include "chrome/browser/bookmarks/bookmark_utils.h" |
17 #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage
r_private_api_constants.h" | 17 #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage
r_private_api_constants.h" |
18 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_constants.h" | 18 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_constants.h" |
19 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.h" | 19 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.h" |
20 #include "chrome/browser/extensions/event_router.h" | 20 #include "chrome/browser/extensions/event_router.h" |
21 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 21 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
22 #include "chrome/browser/extensions/extension_system.h" | 22 #include "chrome/browser/extensions/extension_system.h" |
23 #include "chrome/browser/extensions/extension_web_ui.h" | 23 #include "chrome/browser/extensions/extension_web_ui.h" |
24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/view_type_utils.h" | 25 #include "chrome/browser/view_type_utils.h" |
26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
27 #include "content/public/browser/render_view_host.h" | 27 #include "content/public/browser/render_view_host.h" |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/browser/web_contents_view.h" |
29 #include "content/public/browser/web_ui.h" | 30 #include "content/public/browser/web_ui.h" |
30 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
31 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
32 #include "ui/webui/web_ui_util.h" | 33 #include "ui/webui/web_ui_util.h" |
33 | 34 |
34 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
35 #include "win8/util/win8_util.h" | 36 #include "win8/util/win8_util.h" |
36 #endif // OS_WIN | 37 #endif // OS_WIN |
37 | 38 |
38 namespace extensions { | 39 namespace extensions { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 EXTENSION_FUNCTION_VALIDATE( | 398 EXTENSION_FUNCTION_VALIDATE( |
398 GetNodesFromArguments(model, args_.get(), 0, &nodes)); | 399 GetNodesFromArguments(model, args_.get(), 0, &nodes)); |
399 | 400 |
400 WebContents* web_contents = | 401 WebContents* web_contents = |
401 WebContents::FromRenderViewHost(render_view_host_); | 402 WebContents::FromRenderViewHost(render_view_host_); |
402 if (chrome::GetViewType(web_contents) == chrome::VIEW_TYPE_TAB_CONTENTS) { | 403 if (chrome::GetViewType(web_contents) == chrome::VIEW_TYPE_TAB_CONTENTS) { |
403 WebContents* web_contents = | 404 WebContents* web_contents = |
404 dispatcher()->delegate()->GetAssociatedWebContents(); | 405 dispatcher()->delegate()->GetAssociatedWebContents(); |
405 CHECK(web_contents); | 406 CHECK(web_contents); |
406 bookmark_utils::DragBookmarks(profile(), nodes, | 407 bookmark_utils::DragBookmarks(profile(), nodes, |
407 web_contents->GetNativeView()); | 408 web_contents->GetView()->GetNativeView()); |
408 | 409 |
409 return true; | 410 return true; |
410 } else { | 411 } else { |
411 NOTREACHED(); | 412 NOTREACHED(); |
412 return false; | 413 return false; |
413 } | 414 } |
414 } | 415 } |
415 | 416 |
416 bool BookmarkManagerPrivateDropFunction::RunImpl() { | 417 bool BookmarkManagerPrivateDropFunction::RunImpl() { |
417 if (!EditBookmarksEnabled()) | 418 if (!EditBookmarksEnabled()) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 #if defined(OS_WIN) | 519 #if defined(OS_WIN) |
519 if (win8::IsSingleWindowMetroMode()) | 520 if (win8::IsSingleWindowMetroMode()) |
520 can_open_new_windows = false; | 521 can_open_new_windows = false; |
521 #endif // OS_WIN | 522 #endif // OS_WIN |
522 | 523 |
523 SetResult(new base::FundamentalValue(can_open_new_windows)); | 524 SetResult(new base::FundamentalValue(can_open_new_windows)); |
524 return true; | 525 return true; |
525 } | 526 } |
526 | 527 |
527 } // namespace extensions | 528 } // namespace extensions |
OLD | NEW |