OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_model.h" | 5 #include "chrome/browser/bookmarks/bookmark_model.h" |
6 | 6 |
7 #include "app/gfx/codec/png_codec.h" | 7 #include "app/gfx/codec/png_codec.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "base/scoped_vector.h" | 9 #include "base/scoped_vector.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
641 bool know_favicon, | 641 bool know_favicon, |
642 scoped_refptr<RefCountedBytes> data, | 642 scoped_refptr<RefCountedBytes> data, |
643 bool expired, | 643 bool expired, |
644 GURL icon_url) { | 644 GURL icon_url) { |
645 SkBitmap fav_icon; | 645 SkBitmap fav_icon; |
646 BookmarkNode* node = | 646 BookmarkNode* node = |
647 load_consumer_.GetClientData( | 647 load_consumer_.GetClientData( |
648 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS), handle); | 648 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS), handle); |
649 DCHECK(node); | 649 DCHECK(node); |
650 node->set_favicon_load_handle(0); | 650 node->set_favicon_load_handle(0); |
651 if (know_favicon && data.get() && | 651 if (know_favicon && data.get() && data->size() && |
sky
2009/10/27 16:07:03
nit: !data->data.empty()
| |
652 gfx::PNGCodec::Decode(data->front(), data->size(), &fav_icon)) { | 652 gfx::PNGCodec::Decode(data->front(), data->size(), &fav_icon)) { |
653 node->set_favicon(fav_icon); | 653 node->set_favicon(fav_icon); |
654 FavIconLoaded(node); | 654 FavIconLoaded(node); |
655 } | 655 } |
656 } | 656 } |
657 | 657 |
658 void BookmarkModel::LoadFavIcon(BookmarkNode* node) { | 658 void BookmarkModel::LoadFavIcon(BookmarkNode* node) { |
659 if (node->type() != BookmarkNode::URL) | 659 if (node->type() != BookmarkNode::URL) |
660 return; | 660 return; |
661 | 661 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
726 void BookmarkModel::SetFileChanged() { | 726 void BookmarkModel::SetFileChanged() { |
727 file_changed_ = true; | 727 file_changed_ = true; |
728 } | 728 } |
729 | 729 |
730 BookmarkStorage::LoadDetails* BookmarkModel::CreateLoadDetails() { | 730 BookmarkStorage::LoadDetails* BookmarkModel::CreateLoadDetails() { |
731 BookmarkNode* bb_node = CreateBookmarkNode(); | 731 BookmarkNode* bb_node = CreateBookmarkNode(); |
732 BookmarkNode* other_folder_node = CreateOtherBookmarksNode(); | 732 BookmarkNode* other_folder_node = CreateOtherBookmarksNode(); |
733 return new BookmarkStorage::LoadDetails( | 733 return new BookmarkStorage::LoadDetails( |
734 bb_node, other_folder_node, new BookmarkIndex(profile()), next_node_id_); | 734 bb_node, other_folder_node, new BookmarkIndex(profile()), next_node_id_); |
735 } | 735 } |
OLD | NEW |