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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/app_mode/app_mode_utils.cc
diff --git a/chrome/browser/app_mode/app_mode_utils.cc b/chrome/browser/app_mode/app_mode_utils.cc
index ca3baa5ca11f6533d70c6ae7b7271d23a916f167..c4cdeb247fb66f9cacd98d81b57b0880cc66dcdc 100644
--- a/chrome/browser/app_mode/app_mode_utils.cc
+++ b/chrome/browser/app_mode/app_mode_utils.cc
@@ -4,16 +4,51 @@
#include "chrome/browser/app_mode/app_mode_utils.h"
+#include "base/basictypes.h"
#include "base/command_line.h"
+#include "base/logging.h"
+#include "chrome/app/chrome_command_ids.h"
#include "chrome/common/chrome_switches.h"
namespace chrome {
+bool IsCommandAllowedInAppMode(int command_id) {
+ DCHECK(IsRunningInForcedAppMode());
+
+ const int kAllowed[] = {
+ IDC_BACK,
+ IDC_FORWARD,
+ IDC_RELOAD,
+ IDC_STOP,
+ IDC_RELOAD_IGNORING_CACHE,
+ IDC_RELOAD_CLEARING_CACHE,
+ IDC_CUT,
+ IDC_COPY,
+ IDC_COPY_URL,
+ IDC_PASTE,
+ IDC_ZOOM_PLUS,
+ IDC_ZOOM_NORMAL,
+ IDC_ZOOM_MINUS,
+ };
+
+ for (size_t i = 0; i < arraysize(kAllowed); ++i) {
+ if (kAllowed[i] == command_id)
+ return true;
+ }
+
+ return false;
+}
+
bool IsRunningInAppMode() {
CommandLine* command_line = CommandLine::ForCurrentProcess();
return command_line->HasSwitch(switches::kKioskMode) ||
- (command_line->HasSwitch(switches::kForceAppMode) &&
- command_line->HasSwitch(switches::kAppId));
+ IsRunningInForcedAppMode();
+}
+
+bool IsRunningInForcedAppMode() {
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ return command_line->HasSwitch(switches::kForceAppMode) &&
+ command_line->HasSwitch(switches::kAppId);
}
} // namespace switches
« 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