| 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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 EXTENSION_FUNCTION_VALIDATE(params); | 538 EXTENSION_FUNCTION_VALIDATE(params); |
| 539 | 539 |
| 540 BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile()); | 540 BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile()); |
| 541 std::vector<const BookmarkNode*> nodes; | 541 std::vector<const BookmarkNode*> nodes; |
| 542 EXTENSION_FUNCTION_VALIDATE( | 542 EXTENSION_FUNCTION_VALIDATE( |
| 543 GetNodesFromVector(model, params->id_list, &nodes)); | 543 GetNodesFromVector(model, params->id_list, &nodes)); |
| 544 | 544 |
| 545 WebContents* web_contents = | 545 WebContents* web_contents = |
| 546 WebContents::FromRenderViewHost(render_view_host_); | 546 WebContents::FromRenderViewHost(render_view_host_); |
| 547 if (GetViewType(web_contents) == VIEW_TYPE_TAB_CONTENTS) { | 547 if (GetViewType(web_contents) == VIEW_TYPE_TAB_CONTENTS) { |
| 548 WebContents* web_contents = | 548 WebContents* web_contents = GetAssociatedWebContents(); |
| 549 dispatcher()->delegate()->GetAssociatedWebContents(); | |
| 550 CHECK(web_contents); | 549 CHECK(web_contents); |
| 551 | 550 |
| 552 ui::DragDropTypes::DragEventSource source = | 551 ui::DragDropTypes::DragEventSource source = |
| 553 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; | 552 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; |
| 554 if (params->is_from_touch) | 553 if (params->is_from_touch) |
| 555 source = ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; | 554 source = ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; |
| 556 | 555 |
| 557 chrome::DragBookmarks( | 556 chrome::DragBookmarks( |
| 558 GetProfile(), nodes, web_contents->GetNativeView(), source); | 557 GetProfile(), nodes, web_contents->GetNativeView(), source); |
| 559 | 558 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 579 | 578 |
| 580 int drop_index; | 579 int drop_index; |
| 581 if (params->index) | 580 if (params->index) |
| 582 drop_index = *params->index; | 581 drop_index = *params->index; |
| 583 else | 582 else |
| 584 drop_index = drop_parent->child_count(); | 583 drop_index = drop_parent->child_count(); |
| 585 | 584 |
| 586 WebContents* web_contents = | 585 WebContents* web_contents = |
| 587 WebContents::FromRenderViewHost(render_view_host_); | 586 WebContents::FromRenderViewHost(render_view_host_); |
| 588 if (GetViewType(web_contents) == VIEW_TYPE_TAB_CONTENTS) { | 587 if (GetViewType(web_contents) == VIEW_TYPE_TAB_CONTENTS) { |
| 589 WebContents* web_contents = | 588 WebContents* web_contents = GetAssociatedWebContents(); |
| 590 dispatcher()->delegate()->GetAssociatedWebContents(); | |
| 591 CHECK(web_contents); | 589 CHECK(web_contents); |
| 592 ExtensionWebUI* web_ui = | 590 ExtensionWebUI* web_ui = |
| 593 static_cast<ExtensionWebUI*>(web_contents->GetWebUI()->GetController()); | 591 static_cast<ExtensionWebUI*>(web_contents->GetWebUI()->GetController()); |
| 594 CHECK(web_ui); | 592 CHECK(web_ui); |
| 595 BookmarkManagerPrivateDragEventRouter* router = | 593 BookmarkManagerPrivateDragEventRouter* router = |
| 596 web_ui->bookmark_manager_private_drag_event_router(); | 594 web_ui->bookmark_manager_private_drag_event_router(); |
| 597 | 595 |
| 598 DCHECK(router); | 596 DCHECK(router); |
| 599 const BookmarkNodeData* drag_data = router->GetBookmarkNodeData(); | 597 const BookmarkNodeData* drag_data = router->GetBookmarkNodeData(); |
| 600 if (drag_data == NULL) { | 598 if (drag_data == NULL) { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 | 833 |
| 836 enhanced_bookmarks::EnhancedBookmarkModel* model = | 834 enhanced_bookmarks::EnhancedBookmarkModel* model = |
| 837 enhanced_bookmarks::EnhancedBookmarkModelFactory::GetForBrowserContext( | 835 enhanced_bookmarks::EnhancedBookmarkModelFactory::GetForBrowserContext( |
| 838 browser_context()); | 836 browser_context()); |
| 839 model->SetVersionSuffix(params->version); | 837 model->SetVersionSuffix(params->version); |
| 840 | 838 |
| 841 return true; | 839 return true; |
| 842 } | 840 } |
| 843 | 841 |
| 844 } // namespace extensions | 842 } // namespace extensions |
| OLD | NEW |