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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 } | 376 } |
377 | 377 |
378 bool StartDragBookmarkManagerFunction::RunImpl() { | 378 bool StartDragBookmarkManagerFunction::RunImpl() { |
379 if (!EditBookmarksEnabled()) | 379 if (!EditBookmarksEnabled()) |
380 return false; | 380 return false; |
381 BookmarkModel* model = profile()->GetBookmarkModel(); | 381 BookmarkModel* model = profile()->GetBookmarkModel(); |
382 std::vector<const BookmarkNode*> nodes; | 382 std::vector<const BookmarkNode*> nodes; |
383 EXTENSION_FUNCTION_VALIDATE( | 383 EXTENSION_FUNCTION_VALIDATE( |
384 GetNodesFromArguments(model, args_.get(), 0, &nodes)); | 384 GetNodesFromArguments(model, args_.get(), 0, &nodes)); |
385 | 385 |
386 if (render_view_host_->delegate()->GetRenderViewType() == | 386 if (render_view_host_->GetDelegate()->GetRenderViewType() == |
387 content::VIEW_TYPE_TAB_CONTENTS) { | 387 content::VIEW_TYPE_TAB_CONTENTS) { |
388 WebContents* web_contents = | 388 WebContents* web_contents = |
389 dispatcher()->delegate()->GetAssociatedWebContents(); | 389 dispatcher()->delegate()->GetAssociatedWebContents(); |
390 CHECK(web_contents); | 390 CHECK(web_contents); |
391 bookmark_utils::DragBookmarks(profile(), nodes, | 391 bookmark_utils::DragBookmarks(profile(), nodes, |
392 web_contents->GetNativeView()); | 392 web_contents->GetNativeView()); |
393 | 393 |
394 return true; | 394 return true; |
395 } else { | 395 } else { |
396 NOTREACHED(); | 396 NOTREACHED(); |
(...skipping 21 matching lines...) Expand all Loading... |
418 error_ = keys::kNoParentError; | 418 error_ = keys::kNoParentError; |
419 return false; | 419 return false; |
420 } | 420 } |
421 | 421 |
422 int drop_index; | 422 int drop_index; |
423 if (args_->GetSize() == 2) | 423 if (args_->GetSize() == 2) |
424 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &drop_index)); | 424 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &drop_index)); |
425 else | 425 else |
426 drop_index = drop_parent->child_count(); | 426 drop_index = drop_parent->child_count(); |
427 | 427 |
428 if (render_view_host_->delegate()->GetRenderViewType() == | 428 if (render_view_host_->GetDelegate()->GetRenderViewType() == |
429 content::VIEW_TYPE_TAB_CONTENTS) { | 429 content::VIEW_TYPE_TAB_CONTENTS) { |
430 WebContents* web_contents = | 430 WebContents* web_contents = |
431 dispatcher()->delegate()->GetAssociatedWebContents(); | 431 dispatcher()->delegate()->GetAssociatedWebContents(); |
432 CHECK(web_contents); | 432 CHECK(web_contents); |
433 ExtensionWebUI* web_ui = | 433 ExtensionWebUI* web_ui = |
434 static_cast<ExtensionWebUI*>(web_contents->GetWebUI()->GetController()); | 434 static_cast<ExtensionWebUI*>(web_contents->GetWebUI()->GetController()); |
435 CHECK(web_ui); | 435 CHECK(web_ui); |
436 BookmarkManagerExtensionEventRouter* router = | 436 BookmarkManagerExtensionEventRouter* router = |
437 web_ui->bookmark_manager_extension_event_router(); | 437 web_ui->bookmark_manager_extension_event_router(); |
438 | 438 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 bool CanEditBookmarkManagerFunction::RunImpl() { | 490 bool CanEditBookmarkManagerFunction::RunImpl() { |
491 result_.reset(Value::CreateBooleanValue( | 491 result_.reset(Value::CreateBooleanValue( |
492 profile_->GetPrefs()->GetBoolean(prefs::kEditBookmarksEnabled))); | 492 profile_->GetPrefs()->GetBoolean(prefs::kEditBookmarksEnabled))); |
493 return true; | 493 return true; |
494 } | 494 } |
495 | 495 |
496 bool RecordLaunchBookmarkFunction::RunImpl() { | 496 bool RecordLaunchBookmarkFunction::RunImpl() { |
497 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_MANAGER); | 497 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_MANAGER); |
498 return true; | 498 return true; |
499 } | 499 } |
OLD | NEW |