Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/bookmarks/bookmark_model.cc

Issue 7318001: bookmarks: Rename |loaded_favicon_| to |is_favicon_loaded_| so it matches with the getter accessor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 11 matching lines...) Expand all
22 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
23 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/l10n/l10n_util_collator.h" 24 #include "ui/base/l10n/l10n_util_collator.h"
25 #include "ui/gfx/codec/png_codec.h" 25 #include "ui/gfx/codec/png_codec.h"
26 26
27 using base::Time; 27 using base::Time;
28 28
29 namespace { 29 namespace {
30 30
31 // Helper to get a mutable bookmark node. 31 // Helper to get a mutable bookmark node.
32 static BookmarkNode* AsMutable(const BookmarkNode* node) { 32 BookmarkNode* AsMutable(const BookmarkNode* node) {
33 return const_cast<BookmarkNode*>(node); 33 return const_cast<BookmarkNode*>(node);
34 } 34 }
35 35
36 } // namespace 36 } // namespace
37 37
38 // BookmarkNode --------------------------------------------------------------- 38 // BookmarkNode ---------------------------------------------------------------
39 39
40 BookmarkNode::BookmarkNode(const GURL& url) 40 BookmarkNode::BookmarkNode(const GURL& url)
41 : url_(url) { 41 : url_(url) {
42 Initialize(0); 42 Initialize(0);
43 } 43 }
44 44
45 BookmarkNode::BookmarkNode(int64 id, const GURL& url) 45 BookmarkNode::BookmarkNode(int64 id, const GURL& url)
46 : url_(url) { 46 : url_(url) {
47 Initialize(id); 47 Initialize(id);
48 } 48 }
49 49
50 BookmarkNode::~BookmarkNode() { 50 BookmarkNode::~BookmarkNode() {
51 } 51 }
52 52
53 void BookmarkNode::Initialize(int64 id) { 53 void BookmarkNode::Initialize(int64 id) {
54 id_ = id; 54 id_ = id;
55 loaded_favicon_ = false;
56 favicon_load_handle_ = 0;
57 type_ = !url_.is_empty() ? URL : BOOKMARK_BAR; 55 type_ = !url_.is_empty() ? URL : BOOKMARK_BAR;
58 date_added_ = Time::Now(); 56 date_added_ = Time::Now();
57 favicon_loaded_ = false;
58 favicon_load_handle_ = 0;
59 } 59 }
60 60
61 void BookmarkNode::InvalidateFavicon() { 61 void BookmarkNode::InvalidateFavicon() {
62 loaded_favicon_ = false;
63 favicon_ = SkBitmap(); 62 favicon_ = SkBitmap();
63 favicon_loaded_ = false;
64 } 64 }
65 65
66 bool BookmarkNode::IsVisible() const { 66 bool BookmarkNode::IsVisible() const {
67 // The synced bookmark folder is invisible if the flag isn't set and there are 67 // The synced bookmark folder is invisible if the flag isn't set and there are
68 // no bookmarks under it. 68 // no bookmarks under it.
69 if (type_ != BookmarkNode::SYNCED || 69 if (type_ != BookmarkNode::SYNCED ||
70 CommandLine::ForCurrentProcess()->HasSwitch( 70 CommandLine::ForCurrentProcess()->HasSwitch(
71 switches::kEnableSyncedBookmarksFolder) || !empty()) { 71 switches::kEnableSyncedBookmarksFolder) || !empty()) {
72 return true; 72 return true;
73 } 73 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // CloneBookmarkNode will use BookmarkModel methods to do the job, so we 225 // CloneBookmarkNode will use BookmarkModel methods to do the job, so we
226 // don't need to send notifications here. 226 // don't need to send notifications here.
227 bookmark_utils::CloneBookmarkNode(this, elements, new_parent, index); 227 bookmark_utils::CloneBookmarkNode(this, elements, new_parent, index);
228 228
229 if (store_.get()) 229 if (store_.get())
230 store_->ScheduleSave(); 230 store_->ScheduleSave();
231 } 231 }
232 232
233 const SkBitmap& BookmarkModel::GetFavicon(const BookmarkNode* node) { 233 const SkBitmap& BookmarkModel::GetFavicon(const BookmarkNode* node) {
234 DCHECK(node); 234 DCHECK(node);
235 if (!node->is_favicon_loaded()) { 235 if (!node->favicon_loaded()) {
236 BookmarkNode* mutable_node = AsMutable(node); 236 BookmarkNode* mutable_node = AsMutable(node);
237 mutable_node->set_favicon_loaded(true); 237 mutable_node->set_favicon_loaded(true);
238 LoadFavicon(mutable_node); 238 LoadFavicon(mutable_node);
239 } 239 }
240 return node->favicon(); 240 return node->favicon();
241 } 241 }
242 242
243 void BookmarkModel::SetTitle(const BookmarkNode* node, const string16& title) { 243 void BookmarkModel::SetTitle(const BookmarkNode* node, const string16& title) {
244 if (!node) { 244 if (!node) {
245 NOTREACHED(); 245 NOTREACHED();
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 file_changed_ = true; 805 file_changed_ = true;
806 } 806 }
807 807
808 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() { 808 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() {
809 BookmarkNode* bb_node = CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); 809 BookmarkNode* bb_node = CreatePermanentNode(BookmarkNode::BOOKMARK_BAR);
810 BookmarkNode* other_node = CreatePermanentNode(BookmarkNode::OTHER_NODE); 810 BookmarkNode* other_node = CreatePermanentNode(BookmarkNode::OTHER_NODE);
811 BookmarkNode* synced_node = CreatePermanentNode(BookmarkNode::SYNCED); 811 BookmarkNode* synced_node = CreatePermanentNode(BookmarkNode::SYNCED);
812 return new BookmarkLoadDetails(bb_node, other_node, synced_node, 812 return new BookmarkLoadDetails(bb_node, other_node, synced_node,
813 new BookmarkIndex(profile()), next_node_id_); 813 new BookmarkIndex(profile()), next_node_id_);
814 } 814 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698