| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" | 7 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 if (!entry) | 272 if (!entry) |
| 273 // The NavigationEntry wasn't found, this can happen if the user | 273 // The NavigationEntry wasn't found, this can happen if the user |
| 274 // navigates to another page and a NavigatationEntry falls out of the | 274 // navigates to another page and a NavigatationEntry falls out of the |
| 275 // range of kMaxHistoryItems. | 275 // range of kMaxHistoryItems. |
| 276 return; | 276 return; |
| 277 | 277 |
| 278 // Now that we have a valid NavigationEntry, decode the favicon and assign | 278 // Now that we have a valid NavigationEntry, decode the favicon and assign |
| 279 // it to the NavigationEntry. | 279 // it to the NavigationEntry. |
| 280 SkBitmap fav_icon; | 280 SkBitmap fav_icon; |
| 281 if (gfx::PNGCodec::Decode(favicon.bitmap_data->front(), | 281 if (favicon.variants.size() > 0 && // XXX |
| 282 favicon.bitmap_data->size(), | 282 gfx::PNGCodec::Decode(favicon.variants[0].bitmap_data->front(), |
| 283 favicon.variants[0].bitmap_data->size(), |
| 283 &fav_icon)) { | 284 &fav_icon)) { |
| 284 entry->GetFavicon().valid = true; | 285 entry->GetFavicon().valid = true; |
| 285 entry->GetFavicon().url = favicon.icon_url; | 286 entry->GetFavicon().url = favicon.icon_url; |
| 286 if (fav_icon.empty()) | 287 if (fav_icon.empty()) |
| 287 return; | 288 return; |
| 288 entry->GetFavicon().bitmap = fav_icon; | 289 entry->GetFavicon().bitmap = fav_icon; |
| 289 if (menu_model_delegate()) { | 290 if (menu_model_delegate()) { |
| 290 menu_model_delegate()->OnIconChanged(model_index); | 291 menu_model_delegate()->OnIconChanged(model_index); |
| 291 } | 292 } |
| 292 } | 293 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 metric_string += "ForwardMenu_"; | 469 metric_string += "ForwardMenu_"; |
| 469 else | 470 else |
| 470 metric_string += "BackMenu_"; | 471 metric_string += "BackMenu_"; |
| 471 metric_string += action; | 472 metric_string += action; |
| 472 if (index != -1) { | 473 if (index != -1) { |
| 473 // +1 is for historical reasons (indices used to start at 1). | 474 // +1 is for historical reasons (indices used to start at 1). |
| 474 metric_string += base::IntToString(index + 1); | 475 metric_string += base::IntToString(index + 1); |
| 475 } | 476 } |
| 476 return metric_string; | 477 return metric_string; |
| 477 } | 478 } |
| OLD | NEW |