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/extensions/context_menu_matcher.h" | 5 #include "chrome/browser/extensions/context_menu_matcher.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 301 } |
302 return NULL; | 302 return NULL; |
303 } | 303 } |
304 | 304 |
305 void ContextMenuMatcher::SetExtensionIcon(const std::string& extension_id) { | 305 void ContextMenuMatcher::SetExtensionIcon(const std::string& extension_id) { |
306 MenuManager* menu_manager = MenuManager::Get(browser_context_); | 306 MenuManager* menu_manager = MenuManager::Get(browser_context_); |
307 | 307 |
308 int index = menu_model_->GetItemCount() - 1; | 308 int index = menu_model_->GetItemCount() - 1; |
309 DCHECK_GE(index, 0); | 309 DCHECK_GE(index, 0); |
310 | 310 |
311 const SkBitmap& icon = menu_manager->GetIconForExtension(extension_id); | 311 gfx::Image icon = menu_manager->GetIconForExtension(extension_id); |
312 DCHECK(icon.width() == gfx::kFaviconSize); | 312 DCHECK_EQ(gfx::kFaviconSize, icon.Width()); |
313 DCHECK(icon.height() == gfx::kFaviconSize); | 313 DCHECK_EQ(gfx::kFaviconSize, icon.Height()); |
314 | 314 menu_model_->SetIcon(index, icon); |
315 menu_model_->SetIcon(index, gfx::Image::CreateFrom1xBitmap(icon)); | |
316 } | 315 } |
317 | 316 |
318 } // namespace extensions | 317 } // namespace extensions |
OLD | NEW |