| 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/ui/webui/ntp/android/bookmarks_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/android/bookmarks_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.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/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "chrome/browser/android/tab_android.h" | 13 #include "chrome/browser/android/tab_android.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_model.h" | 14 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 16 #include "chrome/browser/favicon/favicon_service_factory.h" | 17 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 17 #include "chrome/browser/profiles/incognito_helpers.h" | 18 #include "chrome/browser/profiles/incognito_helpers.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/ui/webui/favicon_source.h" | 21 #include "chrome/browser/ui/webui/favicon_source.h" |
| 21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/browser/url_data_source.h" | 24 #include "content/public/browser/url_data_source.h" |
| 24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 25 #include "third_party/skia/include/core/SkBitmap.h" | 26 #include "third_party/skia/include/core/SkBitmap.h" |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 NOTREACHED(); | 514 NOTREACHED(); |
| 514 return NULL; | 515 return NULL; |
| 515 } | 516 } |
| 516 | 517 |
| 517 if (is_managed) | 518 if (is_managed) |
| 518 return managed_bookmarks_shim_->GetNodeByID(id); | 519 return managed_bookmarks_shim_->GetNodeByID(id); |
| 519 | 520 |
| 520 if (is_partner) | 521 if (is_partner) |
| 521 return partner_bookmarks_shim_->GetNodeByID(id); | 522 return partner_bookmarks_shim_->GetNodeByID(id); |
| 522 | 523 |
| 523 return bookmark_model_->GetNodeByID(id); | 524 return GetBookmarkNodeByID(bookmark_model_, id); |
| 524 } | 525 } |
| 525 | 526 |
| 526 const BookmarkNode* BookmarksHandler::GetParentOf( | 527 const BookmarkNode* BookmarksHandler::GetParentOf( |
| 527 const BookmarkNode* node) const { | 528 const BookmarkNode* node) const { |
| 528 DCHECK(AreModelsLoaded()); | 529 DCHECK(AreModelsLoaded()); |
| 529 if (node == managed_bookmarks_shim_->GetManagedBookmarksRoot() || | 530 if (node == managed_bookmarks_shim_->GetManagedBookmarksRoot() || |
| 530 node == partner_bookmarks_shim_->GetPartnerBookmarksRoot()) { | 531 node == partner_bookmarks_shim_->GetPartnerBookmarksRoot()) { |
| 531 return bookmark_model_->mobile_node(); | 532 return bookmark_model_->mobile_node(); |
| 532 } | 533 } |
| 533 | 534 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 return !managed_bookmarks_shim_->IsManagedBookmark(node); | 574 return !managed_bookmarks_shim_->IsManagedBookmark(node); |
| 574 } | 575 } |
| 575 | 576 |
| 576 bool BookmarksHandler::IsRoot(const BookmarkNode* node) const { | 577 bool BookmarksHandler::IsRoot(const BookmarkNode* node) const { |
| 577 DCHECK(AreModelsLoaded()); | 578 DCHECK(AreModelsLoaded()); |
| 578 | 579 |
| 579 return node->is_root() && | 580 return node->is_root() && |
| 580 node != partner_bookmarks_shim_->GetPartnerBookmarksRoot() && | 581 node != partner_bookmarks_shim_->GetPartnerBookmarksRoot() && |
| 581 node != managed_bookmarks_shim_->GetManagedBookmarksRoot(); | 582 node != managed_bookmarks_shim_->GetManagedBookmarksRoot(); |
| 582 } | 583 } |
| OLD | NEW |