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

Side by Side Diff: chrome/browser/app_mode/app_mode_utils.cc

Issue 12389083: cros: Add app mode restrictions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for comments in #3 Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/app_mode/app_mode_utils.h" 5 #include "chrome/browser/app_mode/app_mode_utils.h"
6 6
7 #include "base/basictypes.h"
7 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h"
10 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
9 12
10 namespace chrome { 13 namespace chrome {
11 14
15 bool IsCommandAllowedInAppMode(int command_id) {
16 DCHECK(IsRunningInForcedAppMode());
17
18 const int kAllowed[] = {
19 IDC_BACK,
20 IDC_FORWARD,
21 IDC_RELOAD,
22 IDC_STOP,
23 IDC_RELOAD_IGNORING_CACHE,
24 IDC_RELOAD_CLEARING_CACHE,
25 IDC_CUT,
26 IDC_COPY,
27 IDC_COPY_URL,
28 IDC_PASTE,
29 IDC_ZOOM_PLUS,
30 IDC_ZOOM_NORMAL,
31 IDC_ZOOM_MINUS,
32 };
33
34 for (size_t i = 0; i < arraysize(kAllowed); ++i) {
35 if (kAllowed[i] == command_id)
36 return true;
37 }
38
39 return false;
40 }
41
12 bool IsRunningInAppMode() { 42 bool IsRunningInAppMode() {
13 CommandLine* command_line = CommandLine::ForCurrentProcess(); 43 CommandLine* command_line = CommandLine::ForCurrentProcess();
14 return command_line->HasSwitch(switches::kKioskMode) || 44 return command_line->HasSwitch(switches::kKioskMode) ||
15 (command_line->HasSwitch(switches::kForceAppMode) && 45 IsRunningInForcedAppMode();
16 command_line->HasSwitch(switches::kAppId)); 46 }
47
48 bool IsRunningInForcedAppMode() {
49 CommandLine* command_line = CommandLine::ForCurrentProcess();
50 return command_line->HasSwitch(switches::kForceAppMode) &&
51 command_line->HasSwitch(switches::kAppId);
17 } 52 }
18 53
19 } // namespace switches 54 } // namespace switches
OLDNEW
« no previous file with comments | « chrome/browser/app_mode/app_mode_utils.h ('k') | chrome/browser/tab_contents/render_view_context_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698