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

Side by Side Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 1091173005: Removed the context menu in kiosk mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add the FALL THROUGH comment Created 5 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
« no previous file with comments | « chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_views.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/webui/ntp/app_launcher_handler.h" 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "apps/metrics_names.h" 9 #include "apps/metrics_names.h"
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/command_line.h"
13 #include "base/i18n/rtl.h" 14 #include "base/i18n/rtl.h"
14 #include "base/metrics/field_trial.h" 15 #include "base/metrics/field_trial.h"
15 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
16 #include "base/prefs/pref_service.h" 17 #include "base/prefs/pref_service.h"
17 #include "base/prefs/scoped_user_pref_update.h" 18 #include "base/prefs/scoped_user_pref_update.h"
18 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
19 #include "base/values.h" 20 #include "base/values.h"
20 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/chrome_notification_types.h" 22 #include "chrome/browser/chrome_notification_types.h"
22 #include "chrome/browser/extensions/crx_installer.h" 23 #include "chrome/browser/extensions/crx_installer.h"
23 #include "chrome/browser/extensions/extension_service.h" 24 #include "chrome/browser/extensions/extension_service.h"
24 #include "chrome/browser/extensions/extension_ui_util.h" 25 #include "chrome/browser/extensions/extension_ui_util.h"
25 #include "chrome/browser/extensions/launch_util.h" 26 #include "chrome/browser/extensions/launch_util.h"
26 #include "chrome/browser/favicon/favicon_service_factory.h" 27 #include "chrome/browser/favicon/favicon_service_factory.h"
27 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/ui/app_list/app_list_util.h" 29 #include "chrome/browser/ui/app_list/app_list_util.h"
29 #include "chrome/browser/ui/apps/app_info_dialog.h" 30 #include "chrome/browser/ui/apps/app_info_dialog.h"
30 #include "chrome/browser/ui/browser_dialogs.h" 31 #include "chrome/browser/ui/browser_dialogs.h"
31 #include "chrome/browser/ui/browser_finder.h" 32 #include "chrome/browser/ui/browser_finder.h"
32 #include "chrome/browser/ui/browser_tabstrip.h" 33 #include "chrome/browser/ui/browser_tabstrip.h"
33 #include "chrome/browser/ui/browser_window.h" 34 #include "chrome/browser/ui/browser_window.h"
34 #include "chrome/browser/ui/extensions/app_launch_params.h" 35 #include "chrome/browser/ui/extensions/app_launch_params.h"
35 #include "chrome/browser/ui/extensions/application_launch.h" 36 #include "chrome/browser/ui/extensions/application_launch.h"
36 #include "chrome/browser/ui/extensions/extension_enable_flow.h" 37 #include "chrome/browser/ui/extensions/extension_enable_flow.h"
37 #include "chrome/browser/ui/tabs/tab_strip_model.h" 38 #include "chrome/browser/ui/tabs/tab_strip_model.h"
38 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h" 39 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h"
39 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 40 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
40 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 41 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
42 #include "chrome/common/chrome_switches.h"
41 #include "chrome/common/extensions/extension_constants.h" 43 #include "chrome/common/extensions/extension_constants.h"
42 #include "chrome/common/extensions/extension_metrics.h" 44 #include "chrome/common/extensions/extension_metrics.h"
43 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 45 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
44 #include "chrome/common/pref_names.h" 46 #include "chrome/common/pref_names.h"
45 #include "chrome/common/url_constants.h" 47 #include "chrome/common/url_constants.h"
46 #include "chrome/common/web_application_info.h" 48 #include "chrome/common/web_application_info.h"
47 #include "chrome/grit/generated_resources.h" 49 #include "chrome/grit/generated_resources.h"
48 #include "components/favicon_base/favicon_types.h" 50 #include "components/favicon_base/favicon_types.h"
49 #include "content/public/browser/notification_service.h" 51 #include "content/public/browser/notification_service.h"
50 #include "content/public/browser/web_ui.h" 52 #include "content/public/browser/web_ui.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 111
110 void AppLauncherHandler::CreateAppInfo( 112 void AppLauncherHandler::CreateAppInfo(
111 const Extension* extension, 113 const Extension* extension,
112 ExtensionService* service, 114 ExtensionService* service,
113 base::DictionaryValue* value) { 115 base::DictionaryValue* value) {
114 // The items which are to be written into |value| are also described in 116 // The items which are to be written into |value| are also described in
115 // chrome/browser/resources/ntp4/page_list_view.js in @typedef for AppInfo. 117 // chrome/browser/resources/ntp4/page_list_view.js in @typedef for AppInfo.
116 // Please update it whenever you add or remove any keys here. 118 // Please update it whenever you add or remove any keys here.
117 value->Clear(); 119 value->Clear();
118 120
121 // Communicate the kiosk flag so the apps page can disable showing the
122 // context menu in kiosk mode.
123 value->SetBoolean(
124 "kioskMode",
125 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode));
126
119 // The Extension class 'helpfully' wraps bidi control characters that 127 // The Extension class 'helpfully' wraps bidi control characters that
120 // impede our ability to determine directionality. 128 // impede our ability to determine directionality.
121 base::string16 short_name = base::UTF8ToUTF16(extension->short_name()); 129 base::string16 short_name = base::UTF8ToUTF16(extension->short_name());
122 base::i18n::UnadjustStringForLocaleDirection(&short_name); 130 base::i18n::UnadjustStringForLocaleDirection(&short_name);
123 NewTabUI::SetUrlTitleAndDirection( 131 NewTabUI::SetUrlTitleAndDirection(
124 value, 132 value,
125 short_name, 133 short_name,
126 extensions::AppLaunchInfo::GetFullLaunchURL(extension)); 134 extensions::AppLaunchInfo::GetFullLaunchURL(extension));
127 135
128 base::string16 name = base::UTF8ToUTF16(extension->name()); 136 base::string16 name = base::UTF8ToUTF16(extension->name());
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 base::FundamentalValue(!extension_id_prompting_.empty())); 844 base::FundamentalValue(!extension_id_prompting_.empty()));
837 } 845 }
838 846
839 bool AppLauncherHandler::ShouldShow(const Extension* extension) const { 847 bool AppLauncherHandler::ShouldShow(const Extension* extension) const {
840 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app()) 848 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app())
841 return false; 849 return false;
842 850
843 Profile* profile = Profile::FromWebUI(web_ui()); 851 Profile* profile = Profile::FromWebUI(web_ui());
844 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile); 852 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile);
845 } 853 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_views.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698