| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 namespace chrome { | 117 namespace chrome { |
| 118 | 118 |
| 119 /////////////////////////////////////////////////////////////////////////////// | 119 /////////////////////////////////////////////////////////////////////////////// |
| 120 // BrowserCommandController, public: | 120 // BrowserCommandController, public: |
| 121 | 121 |
| 122 BrowserCommandController::BrowserCommandController(Browser* browser) | 122 BrowserCommandController::BrowserCommandController(Browser* browser) |
| 123 : browser_(browser), | 123 : browser_(browser), |
| 124 command_updater_(this), | 124 command_updater_(this), |
| 125 block_command_execution_(false), | 125 block_command_execution_(false), |
| 126 last_blocked_command_id_(-1), | 126 last_blocked_command_id_(-1), |
| 127 last_blocked_command_disposition_(CURRENT_TAB) { | 127 last_blocked_command_disposition_(WindowOpenDisposition::CURRENT_TAB) { |
| 128 browser_->tab_strip_model()->AddObserver(this); | 128 browser_->tab_strip_model()->AddObserver(this); |
| 129 PrefService* local_state = g_browser_process->local_state(); | 129 PrefService* local_state = g_browser_process->local_state(); |
| 130 if (local_state) { | 130 if (local_state) { |
| 131 local_pref_registrar_.Init(local_state); | 131 local_pref_registrar_.Init(local_state); |
| 132 local_pref_registrar_.Add( | 132 local_pref_registrar_.Add( |
| 133 prefs::kAllowFileSelectionDialogs, | 133 prefs::kAllowFileSelectionDialogs, |
| 134 base::Bind( | 134 base::Bind( |
| 135 &BrowserCommandController::UpdateCommandsForFileSelectionDialogs, | 135 &BrowserCommandController::UpdateCommandsForFileSelectionDialogs, |
| 136 base::Unretained(this))); | 136 base::Unretained(this))); |
| 137 } | 137 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 command_id == IDC_RESTORE_TAB || | 233 command_id == IDC_RESTORE_TAB || |
| 234 command_id == IDC_SELECT_NEXT_TAB || | 234 command_id == IDC_SELECT_NEXT_TAB || |
| 235 command_id == IDC_SELECT_PREVIOUS_TAB || | 235 command_id == IDC_SELECT_PREVIOUS_TAB || |
| 236 command_id == IDC_EXIT; | 236 command_id == IDC_EXIT; |
| 237 } | 237 } |
| 238 | 238 |
| 239 void BrowserCommandController::SetBlockCommandExecution(bool block) { | 239 void BrowserCommandController::SetBlockCommandExecution(bool block) { |
| 240 block_command_execution_ = block; | 240 block_command_execution_ = block; |
| 241 if (block) { | 241 if (block) { |
| 242 last_blocked_command_id_ = -1; | 242 last_blocked_command_id_ = -1; |
| 243 last_blocked_command_disposition_ = CURRENT_TAB; | 243 last_blocked_command_disposition_ = WindowOpenDisposition::CURRENT_TAB; |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 int BrowserCommandController::GetLastBlockedCommand( | 247 int BrowserCommandController::GetLastBlockedCommand( |
| 248 WindowOpenDisposition* disposition) { | 248 WindowOpenDisposition* disposition) { |
| 249 if (disposition) | 249 if (disposition) |
| 250 *disposition = last_blocked_command_disposition_; | 250 *disposition = last_blocked_command_disposition_; |
| 251 return last_blocked_command_id_; | 251 return last_blocked_command_id_; |
| 252 } | 252 } |
| 253 | 253 |
| (...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 | 1264 |
| 1265 BrowserWindow* BrowserCommandController::window() { | 1265 BrowserWindow* BrowserCommandController::window() { |
| 1266 return browser_->window(); | 1266 return browser_->window(); |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 Profile* BrowserCommandController::profile() { | 1269 Profile* BrowserCommandController::profile() { |
| 1270 return browser_->profile(); | 1270 return browser_->profile(); |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 } // namespace chrome | 1273 } // namespace chrome |
| OLD | NEW |