| 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_manager_extension_api.h" | 5 #include "chrome/browser/bookmarks/bookmark_manager_extension_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/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 379 |
| 380 bool StartDragBookmarkManagerFunction::RunImpl() { | 380 bool StartDragBookmarkManagerFunction::RunImpl() { |
| 381 if (!EditBookmarksEnabled()) | 381 if (!EditBookmarksEnabled()) |
| 382 return false; | 382 return false; |
| 383 BookmarkModel* model = profile()->GetBookmarkModel(); | 383 BookmarkModel* model = profile()->GetBookmarkModel(); |
| 384 std::vector<const BookmarkNode*> nodes; | 384 std::vector<const BookmarkNode*> nodes; |
| 385 EXTENSION_FUNCTION_VALIDATE( | 385 EXTENSION_FUNCTION_VALIDATE( |
| 386 GetNodesFromArguments(model, args_.get(), 0, &nodes)); | 386 GetNodesFromArguments(model, args_.get(), 0, &nodes)); |
| 387 | 387 |
| 388 if (render_view_host_->GetDelegate()->GetRenderViewType() == | 388 if (render_view_host_->GetDelegate()->GetRenderViewType() == |
| 389 content::VIEW_TYPE_WEB_CONTENTS) { | 389 chrome::VIEW_TYPE_TAB_CONTENTS) { |
| 390 WebContents* web_contents = | 390 WebContents* web_contents = |
| 391 dispatcher()->delegate()->GetAssociatedWebContents(); | 391 dispatcher()->delegate()->GetAssociatedWebContents(); |
| 392 CHECK(web_contents); | 392 CHECK(web_contents); |
| 393 bookmark_utils::DragBookmarks(profile(), nodes, | 393 bookmark_utils::DragBookmarks(profile(), nodes, |
| 394 web_contents->GetNativeView()); | 394 web_contents->GetNativeView()); |
| 395 | 395 |
| 396 return true; | 396 return true; |
| 397 } else { | 397 } else { |
| 398 NOTREACHED(); | 398 NOTREACHED(); |
| 399 return false; | 399 return false; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 421 return false; | 421 return false; |
| 422 } | 422 } |
| 423 | 423 |
| 424 int drop_index; | 424 int drop_index; |
| 425 if (HasOptionalArgument(1)) | 425 if (HasOptionalArgument(1)) |
| 426 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &drop_index)); | 426 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &drop_index)); |
| 427 else | 427 else |
| 428 drop_index = drop_parent->child_count(); | 428 drop_index = drop_parent->child_count(); |
| 429 | 429 |
| 430 if (render_view_host_->GetDelegate()->GetRenderViewType() == | 430 if (render_view_host_->GetDelegate()->GetRenderViewType() == |
| 431 content::VIEW_TYPE_WEB_CONTENTS) { | 431 chrome::VIEW_TYPE_TAB_CONTENTS) { |
| 432 WebContents* web_contents = | 432 WebContents* web_contents = |
| 433 dispatcher()->delegate()->GetAssociatedWebContents(); | 433 dispatcher()->delegate()->GetAssociatedWebContents(); |
| 434 CHECK(web_contents); | 434 CHECK(web_contents); |
| 435 ExtensionWebUI* web_ui = | 435 ExtensionWebUI* web_ui = |
| 436 static_cast<ExtensionWebUI*>(web_contents->GetWebUI()->GetController()); | 436 static_cast<ExtensionWebUI*>(web_contents->GetWebUI()->GetController()); |
| 437 CHECK(web_ui); | 437 CHECK(web_ui); |
| 438 BookmarkManagerExtensionEventRouter* router = | 438 BookmarkManagerExtensionEventRouter* router = |
| 439 web_ui->bookmark_manager_extension_event_router(); | 439 web_ui->bookmark_manager_extension_event_router(); |
| 440 | 440 |
| 441 DCHECK(router); | 441 DCHECK(router); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 bool CanEditBookmarkManagerFunction::RunImpl() { | 492 bool CanEditBookmarkManagerFunction::RunImpl() { |
| 493 result_.reset(Value::CreateBooleanValue( | 493 result_.reset(Value::CreateBooleanValue( |
| 494 profile_->GetPrefs()->GetBoolean(prefs::kEditBookmarksEnabled))); | 494 profile_->GetPrefs()->GetBoolean(prefs::kEditBookmarksEnabled))); |
| 495 return true; | 495 return true; |
| 496 } | 496 } |
| 497 | 497 |
| 498 bool RecordLaunchBookmarkFunction::RunImpl() { | 498 bool RecordLaunchBookmarkFunction::RunImpl() { |
| 499 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_MANAGER); | 499 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_MANAGER); |
| 500 return true; | 500 return true; |
| 501 } | 501 } |
| OLD | NEW |