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

Side by Side Diff: chrome/browser/extensions/context_menu_matcher.cc

Issue 25366003: Moved some functions off ExtensionService into a new file extension_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile failures Created 7 years, 2 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) 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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/app/chrome_command_ids.h" 6 #include "chrome/app/chrome_command_ids.h"
7 #include "chrome/browser/extensions/context_menu_matcher.h" 7 #include "chrome/browser/extensions/context_menu_matcher.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/extensions/extension_util.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "content/public/common/context_menu_params.h" 12 #include "content/public/common/context_menu_params.h"
12 #include "ui/gfx/favicon_size.h" 13 #include "ui/gfx/favicon_size.h"
13 #include "ui/gfx/image/image.h" 14 #include "ui/gfx/image/image.h"
14 15
15 namespace extensions { 16 namespace extensions {
16 17
17 // static 18 // static
18 const size_t ContextMenuMatcher::kMaxExtensionItemTitleLength = 75; 19 const size_t ContextMenuMatcher::kMaxExtensionItemTitleLength = 75;
19 20
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 *extension = service->GetExtensionById(extension_id, false); 155 *extension = service->GetExtensionById(extension_id, false);
155 156
156 if (!*extension) 157 if (!*extension)
157 return false; 158 return false;
158 159
159 // Find matching items. 160 // Find matching items.
160 const MenuItem::List* all_items = manager->MenuItems(extension_id); 161 const MenuItem::List* all_items = manager->MenuItems(extension_id);
161 if (!all_items || all_items->empty()) 162 if (!all_items || all_items->empty())
162 return false; 163 return false;
163 164
164 *can_cross_incognito = service->CanCrossIncognito(*extension); 165 *can_cross_incognito = extension_util::CanCrossIncognito(*extension, service);
165 items = GetRelevantExtensionItems(*all_items, 166 items = GetRelevantExtensionItems(*all_items,
166 *can_cross_incognito); 167 *can_cross_incognito);
167 168
168 return true; 169 return true;
169 } 170 }
170 171
171 MenuItem::List ContextMenuMatcher::GetRelevantExtensionItems( 172 MenuItem::List ContextMenuMatcher::GetRelevantExtensionItems(
172 const MenuItem::List& items, 173 const MenuItem::List& items,
173 bool can_cross_incognito) { 174 bool can_cross_incognito) {
174 MenuItem::List result; 175 MenuItem::List result;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 DCHECK_GE(index, 0); 268 DCHECK_GE(index, 0);
268 269
269 const SkBitmap& icon = menu_manager->GetIconForExtension(extension_id); 270 const SkBitmap& icon = menu_manager->GetIconForExtension(extension_id);
270 DCHECK(icon.width() == gfx::kFaviconSize); 271 DCHECK(icon.width() == gfx::kFaviconSize);
271 DCHECK(icon.height() == gfx::kFaviconSize); 272 DCHECK(icon.height() == gfx::kFaviconSize);
272 273
273 menu_model_->SetIcon(index, gfx::Image::CreateFrom1xBitmap(icon)); 274 menu_model_->SetIcon(index, gfx::Image::CreateFrom1xBitmap(icon));
274 } 275 }
275 276
276 } // namespace extensions 277 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/windows_event_router.cc ('k') | chrome/browser/extensions/event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698