| 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/browsing_data/cookies_tree_model.h" | 5 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 batches_expected_(0), | 946 batches_expected_(0), |
| 947 batches_seen_(0), | 947 batches_seen_(0), |
| 948 batches_started_(0), | 948 batches_started_(0), |
| 949 batches_ended_(0) { | 949 batches_ended_(0) { |
| 950 data_container_->Init(this); | 950 data_container_->Init(this); |
| 951 } | 951 } |
| 952 | 952 |
| 953 CookiesTreeModel::~CookiesTreeModel() { | 953 CookiesTreeModel::~CookiesTreeModel() { |
| 954 } | 954 } |
| 955 | 955 |
| 956 // static |
| 957 int CookiesTreeModel::GetSendForMessageID(const net::CanonicalCookie& cookie) { |
| 958 if (cookie.IsSecure()) { |
| 959 if (cookie.IsFirstPartyOnly()) |
| 960 return IDS_COOKIES_COOKIE_SENDFOR_SECURE_FIRSTPARTY; |
| 961 return IDS_COOKIES_COOKIE_SENDFOR_SECURE; |
| 962 } |
| 963 if (cookie.IsFirstPartyOnly()) |
| 964 return IDS_COOKIES_COOKIE_SENDFOR_FIRSTPARTY; |
| 965 return IDS_COOKIES_COOKIE_SENDFOR_ANY; |
| 966 } |
| 967 |
| 956 /////////////////////////////////////////////////////////////////////////////// | 968 /////////////////////////////////////////////////////////////////////////////// |
| 957 // CookiesTreeModel, TreeModel methods (public): | 969 // CookiesTreeModel, TreeModel methods (public): |
| 958 | 970 |
| 959 // TreeModel methods: | 971 // TreeModel methods: |
| 960 // Returns the set of icons for the nodes in the tree. You only need override | 972 // Returns the set of icons for the nodes in the tree. You only need override |
| 961 // this if you don't want to use the default folder icons. | 973 // this if you don't want to use the default folder icons. |
| 962 void CookiesTreeModel::GetIcons(std::vector<gfx::ImageSkia>* icons) { | 974 void CookiesTreeModel::GetIcons(std::vector<gfx::ImageSkia>* icons) { |
| 963 icons->push_back(*ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 975 icons->push_back(*ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 964 IDR_DEFAULT_FAVICON).ToImageSkia()); | 976 IDR_DEFAULT_FAVICON).ToImageSkia()); |
| 965 icons->push_back(*ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 977 icons->push_back(*ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 void CookiesTreeModel::MaybeNotifyBatchesEnded() { | 1478 void CookiesTreeModel::MaybeNotifyBatchesEnded() { |
| 1467 // Only notify the observers if this is the outermost call to EndBatch() if | 1479 // Only notify the observers if this is the outermost call to EndBatch() if |
| 1468 // called in a nested manner. | 1480 // called in a nested manner. |
| 1469 if (batches_ended_ == batches_started_ && | 1481 if (batches_ended_ == batches_started_ && |
| 1470 batches_seen_ == batches_expected_) { | 1482 batches_seen_ == batches_expected_) { |
| 1471 FOR_EACH_OBSERVER(Observer, | 1483 FOR_EACH_OBSERVER(Observer, |
| 1472 cookies_observer_list_, | 1484 cookies_observer_list_, |
| 1473 TreeModelEndBatch(this)); | 1485 TreeModelEndBatch(this)); |
| 1474 } | 1486 } |
| 1475 } | 1487 } |
| OLD | NEW |