| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 #endif | 1313 #endif |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 // TODO(devint): http://b/issue?id=1117225 Cut, Copy, and Paste are always | 1316 // TODO(devint): http://b/issue?id=1117225 Cut, Copy, and Paste are always |
| 1317 // enabled in the page menu regardless of whether the command will do | 1317 // enabled in the page menu regardless of whether the command will do |
| 1318 // anything. When someone selects the menu item, we just act as if they hit | 1318 // anything. When someone selects the menu item, we just act as if they hit |
| 1319 // the keyboard shortcut for the command by sending the associated key press | 1319 // the keyboard shortcut for the command by sending the associated key press |
| 1320 // to windows. The real fix to this bug is to disable the commands when they | 1320 // to windows. The real fix to this bug is to disable the commands when they |
| 1321 // won't do anything. We'll need something like an overall clipboard command | 1321 // won't do anything. We'll need something like an overall clipboard command |
| 1322 // manager to do that. | 1322 // manager to do that. |
| 1323 #if !defined(OS_MACOSX) | |
| 1324 void BrowserView::Cut() { | 1323 void BrowserView::Cut() { |
| 1325 ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_X, | 1324 ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_X, |
| 1326 true, false, false, false); | 1325 true, false, false, false); |
| 1327 } | 1326 } |
| 1328 | 1327 |
| 1329 void BrowserView::Copy() { | 1328 void BrowserView::Copy() { |
| 1330 ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_C, | 1329 ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_C, |
| 1331 true, false, false, false); | 1330 true, false, false, false); |
| 1332 } | 1331 } |
| 1333 | 1332 |
| 1334 void BrowserView::Paste() { | 1333 void BrowserView::Paste() { |
| 1335 ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_V, | 1334 ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_V, |
| 1336 true, false, false, false); | 1335 true, false, false, false); |
| 1337 } | 1336 } |
| 1338 #else | |
| 1339 // Mac versions. Not tested by antyhing yet; | |
| 1340 // don't assume written == works. | |
| 1341 void BrowserView::Cut() { | |
| 1342 ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_X, | |
| 1343 false, false, false, true); | |
| 1344 } | |
| 1345 | |
| 1346 void BrowserView::Copy() { | |
| 1347 ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_C, | |
| 1348 false, false, false, true); | |
| 1349 } | |
| 1350 | |
| 1351 void BrowserView::Paste() { | |
| 1352 ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_V, | |
| 1353 false, false, false, true); | |
| 1354 } | |
| 1355 #endif | |
| 1356 | 1337 |
| 1357 void BrowserView::ToggleTabStripMode() { | 1338 void BrowserView::ToggleTabStripMode() { |
| 1358 InitTabStrip(browser_->tabstrip_model()); | 1339 InitTabStrip(browser_->tabstrip_model()); |
| 1359 frame_->TabStripDisplayModeChanged(); | 1340 frame_->TabStripDisplayModeChanged(); |
| 1360 } | 1341 } |
| 1361 | 1342 |
| 1362 void BrowserView::PrepareForInstant() { | 1343 void BrowserView::PrepareForInstant() { |
| 1363 contents_->FadeActiveContents(); | 1344 contents_->FadeActiveContents(); |
| 1364 } | 1345 } |
| 1365 | 1346 |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2576 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2557 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 2577 | 2558 |
| 2578 return view; | 2559 return view; |
| 2579 } | 2560 } |
| 2580 #endif | 2561 #endif |
| 2581 | 2562 |
| 2582 // static | 2563 // static |
| 2583 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2564 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
| 2584 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2565 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
| 2585 } | 2566 } |
| OLD | NEW |