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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.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
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 accelerator, ui::AcceleratorManager::kNormalPriority, this); 2450 accelerator, ui::AcceleratorManager::kNormalPriority, this);
2451 } 2451 }
2452 2452
2453 // We don't need the Windows accelerator table anymore. 2453 // We don't need the Windows accelerator table anymore.
2454 free(accelerators); 2454 free(accelerators);
2455 #else 2455 #else
2456 views::FocusManager* focus_manager = GetFocusManager(); 2456 views::FocusManager* focus_manager = GetFocusManager();
2457 DCHECK(focus_manager); 2457 DCHECK(focus_manager);
2458 2458
2459 // Let's fill our own accelerator table. 2459 // Let's fill our own accelerator table.
2460 const bool is_app_mode = chrome::IsRunningInForcedAppMode();
2460 const std::vector<chrome::AcceleratorMapping> accelerator_list( 2461 const std::vector<chrome::AcceleratorMapping> accelerator_list(
2461 chrome::GetAcceleratorList()); 2462 chrome::GetAcceleratorList());
2462 for (std::vector<chrome::AcceleratorMapping>::const_iterator it = 2463 for (std::vector<chrome::AcceleratorMapping>::const_iterator it =
2463 accelerator_list.begin(); it != accelerator_list.end(); ++it) { 2464 accelerator_list.begin(); it != accelerator_list.end(); ++it) {
2465 // In app mode, only allow accelerators of white listed commands to pass
2466 // through.
2467 if (is_app_mode && !chrome::IsCommandAllowedInAppMode(it->command_id))
2468 continue;
2469
2464 ui::Accelerator accelerator(it->keycode, it->modifiers); 2470 ui::Accelerator accelerator(it->keycode, it->modifiers);
2465 accelerator_table_[accelerator] = it->command_id; 2471 accelerator_table_[accelerator] = it->command_id;
2466 2472
2467 // Also register with the focus manager. 2473 // Also register with the focus manager.
2468 focus_manager->RegisterAccelerator( 2474 focus_manager->RegisterAccelerator(
2469 accelerator, ui::AcceleratorManager::kNormalPriority, this); 2475 accelerator, ui::AcceleratorManager::kNormalPriority, this);
2470 } 2476 }
2471 #endif 2477 #endif
2472 } 2478 }
2473 2479
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
2723 2729
2724 Browser* modal_browser = 2730 Browser* modal_browser =
2725 chrome::FindBrowserWithWebContents(active_dialog->web_contents()); 2731 chrome::FindBrowserWithWebContents(active_dialog->web_contents());
2726 if (modal_browser && (browser_ != modal_browser)) { 2732 if (modal_browser && (browser_ != modal_browser)) {
2727 modal_browser->window()->FlashFrame(true); 2733 modal_browser->window()->FlashFrame(true);
2728 modal_browser->window()->Activate(); 2734 modal_browser->window()->Activate();
2729 } 2735 }
2730 2736
2731 AppModalDialogQueue::GetInstance()->ActivateModalDialog(); 2737 AppModalDialogQueue::GetInstance()->ActivateModalDialog();
2732 } 2738 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698