summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorbryeung@chromium.org <bryeung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-03 00:38:27 +0000
committerbryeung@chromium.org <bryeung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-03 00:38:27 +0000
commit7f05552488f8f9ea5000512fd1972894aee7ee82 (patch)
tree0e2ed5a562335907e44307a1d99e9c6ab8d8a3ec /chrome/browser/autocomplete
parent9d7e8fd4a448491817b816585d6f375d71c0a97a (diff)
downloadchromium_src-7f05552488f8f9ea5000512fd1972894aee7ee82.zip
chromium_src-7f05552488f8f9ea5000512fd1972894aee7ee82.tar.gz
chromium_src-7f05552488f8f9ea5000512fd1972894aee7ee82.tar.bz2
Re-lands 58186:
Original message: """ Move the keyboard files from base/ to app/. Also moves the associated classes/enums from base:: to app::. TEST=try bots compile BUG=NONE Review URL: http://codereview.chromium.org/3165064 """ TBR=phajdan.jr@chromium.org Review URL: http://codereview.chromium.org/3354005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58438 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc54
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.cc28
2 files changed, 41 insertions, 41 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc
index 5b00bab..8ffb9cc 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc
@@ -4,7 +4,7 @@
#include <stdio.h>
-#include "base/keyboard_codes.h"
+#include "app/keyboard_codes.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/platform_thread.h"
@@ -43,24 +43,24 @@ namespace {
const char kSearchKeyword[] = "foo";
const wchar_t kSearchKeywordKeys[] = {
- base::VKEY_F, base::VKEY_O, base::VKEY_O, 0
+ app::VKEY_F, app::VKEY_O, app::VKEY_O, 0
};
const char kSearchURL[] = "http://www.foo.com/search?q={searchTerms}";
const char kSearchShortName[] = "foo";
const char kSearchText[] = "abc";
const wchar_t kSearchTextKeys[] = {
- base::VKEY_A, base::VKEY_B, base::VKEY_C, 0
+ app::VKEY_A, app::VKEY_B, app::VKEY_C, 0
};
const char kSearchTextURL[] = "http://www.foo.com/search?q=abc";
const char kSearchSingleChar[] = "z";
-const wchar_t kSearchSingleCharKeys[] = { base::VKEY_Z, 0 };
+const wchar_t kSearchSingleCharKeys[] = { app::VKEY_Z, 0 };
const char kSearchSingleCharURL[] = "http://www.foo.com/search?q=z";
const char kHistoryPageURL[] = "chrome://history/#q=abc";
const char kDesiredTLDHostname[] = "www.bar.com";
const wchar_t kDesiredTLDKeys[] = {
- base::VKEY_B, base::VKEY_A, base::VKEY_R, 0
+ app::VKEY_B, app::VKEY_A, app::VKEY_R, 0
};
// Hostnames that shall be blocked by host resolver.
@@ -122,7 +122,7 @@ class AutocompleteEditViewTest : public InProcessBrowserTest,
ASSERT_TRUE(*edit_view);
}
- void SendKey(base::KeyboardCode key, bool control, bool shift, bool alt) {
+ void SendKey(app::KeyboardCode key, bool control, bool shift, bool alt) {
gfx::NativeWindow window = NULL;
ASSERT_NO_FATAL_FAILURE(GetNativeWindow(&window));
ASSERT_TRUE(
@@ -132,7 +132,7 @@ class AutocompleteEditViewTest : public InProcessBrowserTest,
void SendKeySequence(const wchar_t* keys) {
for (; *keys; ++keys)
- ASSERT_NO_FATAL_FAILURE(SendKey(static_cast<base::KeyboardCode>(*keys),
+ ASSERT_NO_FATAL_FAILURE(SendKey(static_cast<app::KeyboardCode>(*keys),
false, false, false));
}
@@ -299,25 +299,25 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BrowserAccelerators) {
ASSERT_NO_FATAL_FAILURE(WaitForTabOpenOrClose(tab_count + 1));
// Select the first Tab.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_1, true, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_1, true, false, false));
ASSERT_EQ(0, browser()->selected_index());
browser()->FocusLocationBar();
// Select the second Tab.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_2, true, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_2, true, false, false));
ASSERT_EQ(1, browser()->selected_index());
browser()->FocusLocationBar();
// Close a Tab.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_W, true, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_W, true, false, false));
ASSERT_NO_FATAL_FAILURE(WaitForTabOpenOrClose(tab_count));
// Try ctrl-l to focus location bar.
edit_view->SetUserText(L"Hello world");
EXPECT_FALSE(edit_view->IsSelectAll());
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_L, true, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_L, true, false, false));
EXPECT_TRUE(edit_view->IsSelectAll());
}
@@ -334,17 +334,17 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BackspaceInKeywordMode) {
ASSERT_EQ(kSearchKeyword, WideToUTF8(edit_view->model()->keyword()));
// Trigger keyword mode.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_TAB, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_TAB, false, false, false));
ASSERT_FALSE(edit_view->model()->is_keyword_hint());
ASSERT_EQ(kSearchKeyword, WideToUTF8(edit_view->model()->keyword()));
// Backspace without search text should bring back keyword hint mode.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_BACK, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false));
ASSERT_TRUE(edit_view->model()->is_keyword_hint());
ASSERT_EQ(kSearchKeyword, WideToUTF8(edit_view->model()->keyword()));
// Trigger keyword mode again.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_TAB, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_TAB, false, false, false));
ASSERT_FALSE(edit_view->model()->is_keyword_hint());
ASSERT_EQ(kSearchKeyword, WideToUTF8(edit_view->model()->keyword()));
@@ -354,7 +354,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BackspaceInKeywordMode) {
// Should stay in keyword mode while deleting search text by pressing
// backspace.
for (size_t i = 0; i < arraysize(kSearchText) - 1; ++i) {
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_BACK, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false));
ASSERT_FALSE(edit_view->model()->is_keyword_hint());
ASSERT_EQ(kSearchKeyword, WideToUTF8(edit_view->model()->keyword()));
}
@@ -363,10 +363,10 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BackspaceInKeywordMode) {
ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextKeys));
// Move cursor to the beginning of the search text.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_HOME, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_HOME, false, false, false));
// Backspace at the beginning of the search text shall turn off
// the keyword mode.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_BACK, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false));
ASSERT_FALSE(edit_view->model()->is_keyword_hint());
ASSERT_EQ(std::string(), WideToUTF8(edit_view->model()->keyword()));
ASSERT_EQ(std::string(kSearchKeyword) + kSearchText,
@@ -386,11 +386,11 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, Escape) {
EXPECT_TRUE(edit_view->IsSelectAll());
// Delete all text in omnibox.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_BACK, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false));
EXPECT_TRUE(edit_view->GetText().empty());
// Escape shall revert the text in omnibox.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_ESCAPE, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_ESCAPE, false, false, false));
EXPECT_EQ(old_text, edit_view->GetText());
EXPECT_TRUE(edit_view->IsSelectAll());
}
@@ -409,7 +409,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, DesiredTLD) {
ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
ASSERT_TRUE(popup_model->IsOpen());
// ctrl-Enter triggers desired_tld feature, thus www.bar.com shall be opened.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_RETURN, true, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN, true, false, false));
GURL url = browser()->GetSelectedTabContents()->GetURL();
EXPECT_STREQ(kDesiredTLDHostname, url.host().c_str());
@@ -426,7 +426,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, AltEnter) {
edit_view->SetUserText(ASCIIToWide(chrome::kChromeUIHistoryURL));
int tab_count = browser()->tab_count();
// alt-Enter opens a new tab.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_RETURN, false, false, true));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN, false, false, true));
ASSERT_NO_FATAL_FAILURE(WaitForTabOpenOrClose(tab_count + 1));
}
@@ -450,7 +450,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EnterToSearch) {
popup_model->result().default_match()->type);
// Open the default match.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_RETURN, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN, false, false, false));
GURL url = browser()->GetSelectedTabContents()->GetURL();
EXPECT_STREQ(kSearchTextURL, url.spec().c_str());
@@ -467,7 +467,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EnterToSearch) {
popup_model->result().default_match()->type);
// Open the default match.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_RETURN, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN, false, false, false));
url = browser()->GetSelectedTabContents()->GetURL();
EXPECT_STREQ(kSearchSingleCharURL, url.spec().c_str());
}
@@ -495,7 +495,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EnterToOpenHistoryPage) {
AutocompleteMatch::OPEN_HISTORY_PAGE)
break;
size_t old_selected_line = popup_model->selected_line();
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_DOWN, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_DOWN, false, false, false));
ASSERT_EQ(old_selected_line + 1, popup_model->selected_line());
if (popup_model->selected_line() == size - 1)
break;
@@ -506,7 +506,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EnterToOpenHistoryPage) {
popup_model->result().match_at(popup_model->selected_line()).type);
// Open the history page item.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_RETURN, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN, false, false, false));
GURL url = browser()->GetSelectedTabContents()->GetURL();
EXPECT_STREQ(kHistoryPageURL, url.spec().c_str());
}
@@ -536,7 +536,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EscapeToDefaultMatch) {
// Move to another line with different text.
size_t size = popup_model->result().size();
while (popup_model->selected_line() < size - 1) {
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_DOWN, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_DOWN, false, false, false));
ASSERT_NE(old_selected_line, popup_model->selected_line());
if (old_text != edit_view->GetText())
break;
@@ -545,7 +545,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EscapeToDefaultMatch) {
EXPECT_NE(old_text, edit_view->GetText());
// Escape shall revert back to the default match item.
- ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_ESCAPE, false, false, false));
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_ESCAPE, false, false, false));
EXPECT_EQ(old_text, edit_view->GetText());
EXPECT_EQ(old_selected_line, popup_model->selected_line());
}
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index 0230fb3..e75ce26 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -13,6 +13,7 @@
#include "app/clipboard/clipboard.h"
#include "app/clipboard/scoped_clipboard_writer.h"
+#include "app/keyboard_codes.h"
#include "app/l10n_util.h"
#include "app/l10n_util_win.h"
#include "app/os_exchange_data.h"
@@ -24,7 +25,6 @@
#include "base/basictypes.h"
#include "base/i18n/rtl.h"
#include "base/iat_patch.h"
-#include "base/keyboard_codes.h"
#include "base/lazy_instance.h"
#include "base/ref_counted.h"
#include "base/utf_string_conversions.h"
@@ -877,10 +877,10 @@ void AutocompleteEditViewWin::PasteAndGo(const std::wstring& text) {
bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing(
const views::KeyEvent& e) {
- base::KeyboardCode key = e.GetKeyCode();
+ app::KeyboardCode key = e.GetKeyCode();
// We don't process ALT + numpad digit as accelerators, they are used for
// entering special characters. We do translate alt-home.
- if (e.IsAltDown() && (key != base::VKEY_HOME) &&
+ if (e.IsAltDown() && (key != app::VKEY_HOME) &&
win_util::IsNumPadDigit(key, e.IsExtendedKey()))
return true;
@@ -892,28 +892,28 @@ bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing(
// accelerators (e.g., F5 for reload the page should work even when the
// Omnibox gets focused).
switch (key) {
- case base::VKEY_ESCAPE: {
+ case app::VKEY_ESCAPE: {
ScopedFreeze freeze(this, GetTextObjectModel());
return model_->OnEscapeKeyPressed();
}
- case base::VKEY_RETURN:
+ case app::VKEY_RETURN:
return true;
- case base::VKEY_UP:
- case base::VKEY_DOWN:
+ case app::VKEY_UP:
+ case app::VKEY_DOWN:
return !e.IsAltDown();
- case base::VKEY_DELETE:
- case base::VKEY_INSERT:
+ case app::VKEY_DELETE:
+ case app::VKEY_INSERT:
return !e.IsAltDown() && e.IsShiftDown() && !e.IsControlDown();
- case base::VKEY_X:
- case base::VKEY_V:
+ case app::VKEY_X:
+ case app::VKEY_V:
return !e.IsAltDown() && e.IsControlDown();
- case base::VKEY_BACK:
- case base::VKEY_OEM_PLUS:
+ case app::VKEY_BACK:
+ case app::VKEY_OEM_PLUS:
return true;
default:
@@ -1761,7 +1761,7 @@ void AutocompleteEditViewWin::HandleKeystroke(UINT message,
ScopedFreeze freeze(this, GetTextObjectModel());
OnBeforePossibleChange();
- if (key == base::VKEY_HOME || key == base::VKEY_END) {
+ if (key == app::VKEY_HOME || key == app::VKEY_END) {
// DefWindowProc() might reset the keyboard layout when it receives a
// keydown event for VKEY_HOME or VKEY_END. When the window was created
// with WS_EX_LAYOUTRTL and the current keyboard layout is not a RTL one,