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
3 // found in the LICENSE file.
5 #include "chrome/browser/app_mode/app_mode_utils.h"
7 #include "base/basictypes.h"
8 #include "base/command_line.h"
9 #include "base/logging.h"
10 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/common/chrome_switches.h"
15 bool IsCommandAllowedInAppMode(int command_id
) {
16 DCHECK(IsRunningInForcedAppMode());
18 const int kAllowed
[] = {
23 IDC_RELOAD_IGNORING_CACHE
,
24 IDC_RELOAD_CLEARING_CACHE
,
33 for (size_t i
= 0; i
< arraysize(kAllowed
); ++i
) {
34 if (kAllowed
[i
] == command_id
)
41 bool IsRunningInAppMode() {
42 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
43 return command_line
->HasSwitch(switches::kKioskMode
) ||
44 IsRunningInForcedAppMode();
47 bool IsRunningInForcedAppMode() {
48 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
49 return command_line
->HasSwitch(switches::kForceAppMode
) &&
50 command_line
->HasSwitch(switches::kAppId
);