| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifdef CHROME_PERSONALIZATION | 5 #ifdef CHROME_PERSONALIZATION |
| 6 | 6 |
| 7 #include "chrome/browser/sync/glue/change_processor.h" | 7 #include "chrome/browser/sync/glue/change_processor.h" |
| 8 | 8 |
| 9 #include "base/gfx/png_encoder.h" | 9 #include "app/gfx/codec/png_codec.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_utils.h" | 11 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 12 #include "chrome/browser/favicon_service.h" | 12 #include "chrome/browser/favicon_service.h" |
| 13 #include "chrome/browser/profile.h" | 13 #include "chrome/browser/profile.h" |
| 14 #include "chrome/browser/sync/profile_sync_service.h" | 14 #include "chrome/browser/sync/profile_sync_service.h" |
| 15 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
| 16 | 16 |
| 17 namespace browser_sync { | 17 namespace browser_sync { |
| 18 | 18 |
| 19 void ChangeProcessor::Start(BookmarkModel* model, sync_api::UserShare* handle) { | 19 void ChangeProcessor::Start(BookmarkModel* model, sync_api::UserShare* handle) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 dst->clear(); | 59 dst->clear(); |
| 60 | 60 |
| 61 // Check for zero-dimension images. This can happen if the favicon is | 61 // Check for zero-dimension images. This can happen if the favicon is |
| 62 // still being loaded. | 62 // still being loaded. |
| 63 if (favicon.empty()) | 63 if (favicon.empty()) |
| 64 return; | 64 return; |
| 65 | 65 |
| 66 // Re-encode the BookmarkNode's favicon as a PNG, and pass the data to the | 66 // Re-encode the BookmarkNode's favicon as a PNG, and pass the data to the |
| 67 // sync subsystem. | 67 // sync subsystem. |
| 68 if (!PNGEncoder::EncodeBGRASkBitmap(favicon, false, dst)) | 68 if (!gfx::PNGCodec::EncodeBGRASkBitmap(favicon, false, dst)) |
| 69 return; | 69 return; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void ChangeProcessor::RemoveOneSyncNode(sync_api::WriteTransaction* trans, | 72 void ChangeProcessor::RemoveOneSyncNode(sync_api::WriteTransaction* trans, |
| 73 const BookmarkNode* node) { | 73 const BookmarkNode* node) { |
| 74 sync_api::WriteNode sync_node(trans); | 74 sync_api::WriteNode sync_node(trans); |
| 75 if (!model_associator_->InitSyncNodeFromBookmarkId(node->id(), &sync_node)) { | 75 if (!model_associator_->InitSyncNodeFromBookmarkId(node->id(), &sync_node)) { |
| 76 error_handler_->OnUnrecoverableError(); | 76 error_handler_->OnUnrecoverableError(); |
| 77 return; | 77 return; |
| 78 } | 78 } |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 sync_api::WriteNode* sync_node) { | 535 sync_api::WriteNode* sync_node) { |
| 536 std::vector<unsigned char> favicon_bytes; | 536 std::vector<unsigned char> favicon_bytes; |
| 537 EncodeFavicon(bookmark_node, model, &favicon_bytes); | 537 EncodeFavicon(bookmark_node, model, &favicon_bytes); |
| 538 if (!favicon_bytes.empty()) | 538 if (!favicon_bytes.empty()) |
| 539 sync_node->SetFaviconBytes(&favicon_bytes[0], favicon_bytes.size()); | 539 sync_node->SetFaviconBytes(&favicon_bytes[0], favicon_bytes.size()); |
| 540 } | 540 } |
| 541 | 541 |
| 542 } // namespace browser_sync | 542 } // namespace browser_sync |
| 543 | 543 |
| 544 #endif // CHROME_PERSONALIZATION | 544 #endif // CHROME_PERSONALIZATION |
| OLD | NEW |