| OLD | NEW |
| 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/browser_command_controller.h" | 5 #include "chrome/browser/ui/browser_command_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 namespace chrome { | 99 namespace chrome { |
| 100 | 100 |
| 101 /////////////////////////////////////////////////////////////////////////////// | 101 /////////////////////////////////////////////////////////////////////////////// |
| 102 // BrowserCommandController, public: | 102 // BrowserCommandController, public: |
| 103 | 103 |
| 104 BrowserCommandController::BrowserCommandController(Browser* browser) | 104 BrowserCommandController::BrowserCommandController(Browser* browser) |
| 105 : browser_(browser), | 105 : browser_(browser), |
| 106 command_updater_(this), | 106 command_updater_(this), |
| 107 block_command_execution_(false), | 107 block_command_execution_(false), |
| 108 last_blocked_command_id_(-1), | 108 last_blocked_command_id_(-1), |
| 109 last_blocked_command_disposition_(CURRENT_TAB) { | 109 last_blocked_command_disposition_(WindowOpenDisposition::CURRENT_TAB) { |
| 110 browser_->tab_strip_model()->AddObserver(this); | 110 browser_->tab_strip_model()->AddObserver(this); |
| 111 PrefService* local_state = g_browser_process->local_state(); | 111 PrefService* local_state = g_browser_process->local_state(); |
| 112 if (local_state) { | 112 if (local_state) { |
| 113 local_pref_registrar_.Init(local_state); | 113 local_pref_registrar_.Init(local_state); |
| 114 local_pref_registrar_.Add( | 114 local_pref_registrar_.Add( |
| 115 prefs::kAllowFileSelectionDialogs, | 115 prefs::kAllowFileSelectionDialogs, |
| 116 base::Bind( | 116 base::Bind( |
| 117 &BrowserCommandController::UpdateCommandsForFileSelectionDialogs, | 117 &BrowserCommandController::UpdateCommandsForFileSelectionDialogs, |
| 118 base::Unretained(this))); | 118 base::Unretained(this))); |
| 119 } | 119 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 command_id == IDC_RESTORE_TAB || | 215 command_id == IDC_RESTORE_TAB || |
| 216 command_id == IDC_SELECT_NEXT_TAB || | 216 command_id == IDC_SELECT_NEXT_TAB || |
| 217 command_id == IDC_SELECT_PREVIOUS_TAB || | 217 command_id == IDC_SELECT_PREVIOUS_TAB || |
| 218 command_id == IDC_EXIT; | 218 command_id == IDC_EXIT; |
| 219 } | 219 } |
| 220 | 220 |
| 221 void BrowserCommandController::SetBlockCommandExecution(bool block) { | 221 void BrowserCommandController::SetBlockCommandExecution(bool block) { |
| 222 block_command_execution_ = block; | 222 block_command_execution_ = block; |
| 223 if (block) { | 223 if (block) { |
| 224 last_blocked_command_id_ = -1; | 224 last_blocked_command_id_ = -1; |
| 225 last_blocked_command_disposition_ = CURRENT_TAB; | 225 last_blocked_command_disposition_ = WindowOpenDisposition::CURRENT_TAB; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 int BrowserCommandController::GetLastBlockedCommand( | 229 int BrowserCommandController::GetLastBlockedCommand( |
| 230 WindowOpenDisposition* disposition) { | 230 WindowOpenDisposition* disposition) { |
| 231 if (disposition) | 231 if (disposition) |
| 232 *disposition = last_blocked_command_disposition_; | 232 *disposition = last_blocked_command_disposition_; |
| 233 return last_blocked_command_id_; | 233 return last_blocked_command_id_; |
| 234 } | 234 } |
| 235 | 235 |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 | 1159 |
| 1160 BrowserWindow* BrowserCommandController::window() { | 1160 BrowserWindow* BrowserCommandController::window() { |
| 1161 return browser_->window(); | 1161 return browser_->window(); |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 Profile* BrowserCommandController::profile() { | 1164 Profile* BrowserCommandController::profile() { |
| 1165 return browser_->profile(); | 1165 return browser_->profile(); |
| 1166 } | 1166 } |
| 1167 | 1167 |
| 1168 } // namespace chrome | 1168 } // namespace chrome |
| OLD | NEW |