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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 "chrome/browser/extensions/extension_context_menu_model.h" 5 #include "chrome/browser/extensions/extension_context_menu_model.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.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_tab_helper.h" 10 #include "chrome/browser/extensions/extension_tab_helper.h"
11 #include "chrome/browser/extensions/extension_tab_util.h" 11 #include "chrome/browser/extensions/extension_tab_util.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_tabstrip.h"
15 #include "chrome/browser/ui/chrome_pages.h" 16 #include "chrome/browser/ui/chrome_pages.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents.h"
17 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
18 #include "chrome/common/extensions/extension_action.h" 19 #include "chrome/common/extensions/extension_action.h"
19 #include "chrome/common/extensions/extension_constants.h" 20 #include "chrome/common/extensions/extension_constants.h"
20 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
21 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
22 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
23 #include "grit/chromium_strings.h" 24 #include "grit/chromium_strings.h"
24 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (!extension) 68 if (!extension)
68 return false; 69 return false;
69 70
70 if (command_id == CONFIGURE) { 71 if (command_id == CONFIGURE) {
71 return extension->options_url().spec().length() > 0; 72 return extension->options_url().spec().length() > 0;
72 } else if (command_id == NAME) { 73 } else if (command_id == NAME) {
73 // The NAME links to the Homepage URL. If the extension doesn't have a 74 // The NAME links to the Homepage URL. If the extension doesn't have a
74 // homepage, we just disable this menu item. 75 // homepage, we just disable this menu item.
75 return extension->GetHomepageURL().is_valid(); 76 return extension->GetHomepageURL().is_valid();
76 } else if (command_id == INSPECT_POPUP) { 77 } else if (command_id == INSPECT_POPUP) {
77 TabContents* tab_contents = browser_->GetActiveTabContents(); 78 TabContents* tab_contents = chrome::GetActiveTabContents(browser_);
78 if (!tab_contents) 79 if (!tab_contents)
79 return false; 80 return false;
80 81
81 return extension_action_->HasPopup( 82 return extension_action_->HasPopup(
82 tab_contents->extension_tab_helper()->tab_id()); 83 tab_contents->extension_tab_helper()->tab_id());
83 } else if (command_id == DISABLE || command_id == UNINSTALL) { 84 } else if (command_id == DISABLE || command_id == UNINSTALL) {
84 // Some extension types can not be disabled or uninstalled. 85 // Some extension types can not be disabled or uninstalled.
85 return ExtensionSystem::Get( 86 return ExtensionSystem::Get(
86 profile_)->management_policy()->UserMayModifySettings(extension, NULL); 87 profile_)->management_policy()->UserMayModifySettings(extension, NULL);
87 } 88 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if (extension->browser_action()) 174 if (extension->browser_action())
174 AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON); 175 AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON);
175 AddSeparator(); 176 AddSeparator();
176 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSIONS); 177 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSIONS);
177 } 178 }
178 179
179 const Extension* ExtensionContextMenuModel::GetExtension() const { 180 const Extension* ExtensionContextMenuModel::GetExtension() const {
180 ExtensionService* extension_service = profile_->GetExtensionService(); 181 ExtensionService* extension_service = profile_->GetExtensionService();
181 return extension_service->GetExtensionById(extension_id_, false); 182 return extension_service->GetExtensionById(extension_id_, false);
182 } 183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698