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

Side by Side Diff: chrome/browser/ui/app_list/app_context_menu.cc

Issue 186213003: <webview>: Context menu API implementation CL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @tott Created 6 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/app_list/app_context_menu.h" 5 #include "chrome/browser/ui/app_list/app_context_menu.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/extensions/context_menu_matcher.h" 10 #include "chrome/browser/extensions/context_menu_matcher.h"
11 #include "chrome/browser/extensions/menu_manager.h"
11 #include "chrome/browser/prefs/incognito_mode_prefs.h" 12 #include "chrome/browser/prefs/incognito_mode_prefs.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" 14 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h"
14 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" 15 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
15 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/extensions/extension_constants.h" 17 #include "chrome/common/extensions/extension_constants.h"
17 #include "chrome/common/extensions/manifest_url_handler.h" 18 #include "chrome/common/extensions/manifest_url_handler.h"
18 #include "content/public/common/context_menu_params.h" 19 #include "content/public/common/context_menu_params.h"
19 #include "grit/chromium_strings.h" 20 #include "grit/chromium_strings.h"
20 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 91 }
91 } else { 92 } else {
92 extension_menu_items_.reset(new extensions::ContextMenuMatcher( 93 extension_menu_items_.reset(new extensions::ContextMenuMatcher(
93 profile_, this, menu_model_.get(), 94 profile_, this, menu_model_.get(),
94 base::Bind(MenuItemHasLauncherContext))); 95 base::Bind(MenuItemHasLauncherContext)));
95 96
96 if (!is_platform_app_) 97 if (!is_platform_app_)
97 menu_model_->AddItem(LAUNCH_NEW, base::string16()); 98 menu_model_->AddItem(LAUNCH_NEW, base::string16());
98 99
99 int index = 0; 100 int index = 0;
100 extension_menu_items_->AppendExtensionItems(app_id_, base::string16(), 101 extension_menu_items_->AppendExtensionItems(
101 &index); 102 extensions::MenuItem::ExtensionKey(app_id_), base::string16(), &index);
102 103
103 // Show Pin/Unpin option if shelf is available. 104 // Show Pin/Unpin option if shelf is available.
104 if (controller_->GetPinnable() != AppListControllerDelegate::NO_PIN) { 105 if (controller_->GetPinnable() != AppListControllerDelegate::NO_PIN) {
105 menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); 106 menu_model_->AddSeparator(ui::NORMAL_SEPARATOR);
106 menu_model_->AddItemWithStringId( 107 menu_model_->AddItemWithStringId(
107 TOGGLE_PIN, 108 TOGGLE_PIN,
108 controller_->IsAppPinned(app_id_) ? 109 controller_->IsAppPinned(app_id_) ?
109 IDS_APP_LIST_CONTEXT_MENU_UNPIN : 110 IDS_APP_LIST_CONTEXT_MENU_UNPIN :
110 IDS_APP_LIST_CONTEXT_MENU_PIN); 111 IDS_APP_LIST_CONTEXT_MENU_PIN);
111 } 112 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 extension_menu_items_->ExecuteCommand(command_id, NULL, 274 extension_menu_items_->ExecuteCommand(command_id, NULL,
274 content::ContextMenuParams()); 275 content::ContextMenuParams());
275 } else if (command_id == MENU_NEW_WINDOW) { 276 } else if (command_id == MENU_NEW_WINDOW) {
276 controller_->CreateNewWindow(profile_, false); 277 controller_->CreateNewWindow(profile_, false);
277 } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { 278 } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) {
278 controller_->CreateNewWindow(profile_, true); 279 controller_->CreateNewWindow(profile_, true);
279 } 280 }
280 } 281 }
281 282
282 } // namespace app_list 283 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698