summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-19 19:01:14 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-19 19:01:14 +0000
commiteed084d901efe457300e673972a0369406bd5e66 (patch)
tree82f94f52879937ded20a1fc7932bfbc300e408bf /chrome/browser/autocomplete
parentb8f41a197500eb0d6fbff3e8f1216d99a49b7d07 (diff)
downloadchromium_src-eed084d901efe457300e673972a0369406bd5e66.zip
chromium_src-eed084d901efe457300e673972a0369406bd5e66.tar.gz
chromium_src-eed084d901efe457300e673972a0369406bd5e66.tar.bz2
SSL UI changes, Windows, code side (images are separate).
* Remove "Type to search" hint * Remove "Untrusted website" label * Add EV cert bubble, make it function like a location icon for clicks/drags * Modify spacing for EV/tab-to-search bubbles to keep icons and text aligned with dropdown * Change non-EV HTTPS coloring from blue to green Mac and Linux should compile, but only some of the above changes have been made for them. Specifically, there is no EV cert bubble, the non-EV scheme color isn't changed, and the icon/text alignment in the tab-to-search bubble hasn't been touched. BUG=41481 TEST=paypal.com should generate a bubble around the lock and cert holder name, which responds to clicks and drags like the location icon would Review URL: http://codereview.chromium.org/1585043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44929 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.cc25
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.h21
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc5
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.mm5
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.cc17
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_model.cc4
6 files changed, 15 insertions, 62 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc
index 22c6802..9b0aefb 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit.cc
@@ -44,7 +44,6 @@ AutocompleteEditModel::AutocompleteEditModel(
control_key_state_(UP),
is_keyword_hint_(false),
keyword_ui_state_(NORMAL),
- show_search_hint_(true),
paste_and_go_transition_(PageTransition::TYPED),
profile_(profile) {
}
@@ -81,7 +80,7 @@ const AutocompleteEditModel::State
}
return State(user_input_in_progress_, user_text_, keyword_, is_keyword_hint_,
- keyword_ui_state_, show_search_hint_);
+ keyword_ui_state_);
}
void AutocompleteEditModel::RestoreState(const State& state) {
@@ -92,7 +91,6 @@ void AutocompleteEditModel::RestoreState(const State& state) {
keyword_ = state.keyword;
is_keyword_hint_ = state.is_keyword_hint;
keyword_ui_state_ = state.keyword_ui_state;
- show_search_hint_ = state.show_search_hint;
view_->SetUserText(state.user_text,
DisplayTextFromUserText(state.user_text), false);
}
@@ -182,7 +180,6 @@ void AutocompleteEditModel::Revert() {
keyword_.clear();
is_keyword_hint_ = false;
keyword_ui_state_ = NORMAL;
- show_search_hint_ = permanent_text_.empty();
has_temporary_text_ = false;
view_->SetWindowTextAndCaretPos(permanent_text_,
has_focus_ ? permanent_text_.length() : 0);
@@ -412,24 +409,13 @@ void AutocompleteEditModel::OnPopupDataChanged(
const std::wstring& text,
GURL* destination_for_temporary_text_change,
const std::wstring& keyword,
- bool is_keyword_hint,
- AutocompleteMatch::Type type) {
- // We don't want to show the search hint if we're showing a keyword hint or
- // selected keyword, or (subtle!) if we would be showing a selected keyword
- // but for keyword_ui_state_ == NO_KEYWORD.
- const bool show_search_hint = keyword.empty() &&
- ((type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED) ||
- (type == AutocompleteMatch::SEARCH_HISTORY) ||
- (type == AutocompleteMatch::SEARCH_SUGGEST));
-
+ bool is_keyword_hint) {
// Update keyword/hint-related local state.
bool keyword_state_changed = (keyword_ != keyword) ||
- ((is_keyword_hint_ != is_keyword_hint) && !keyword.empty()) ||
- (show_search_hint_ != show_search_hint);
+ ((is_keyword_hint_ != is_keyword_hint) && !keyword.empty());
if (keyword_state_changed) {
keyword_ = keyword;
is_keyword_hint_ = is_keyword_hint;
- show_search_hint_ = show_search_hint;
}
// Handle changes to temporary text.
@@ -547,7 +533,6 @@ void AutocompleteEditModel::Observe(NotificationType type,
std::wstring inline_autocomplete_text;
std::wstring keyword;
bool is_keyword_hint = false;
- AutocompleteMatch::Type match_type = AutocompleteMatch::SEARCH_WHAT_YOU_TYPED;
const AutocompleteResult* result =
Details<const AutocompleteResult>(details).ptr();
const AutocompleteResult::const_iterator match(result->default_match());
@@ -564,11 +549,9 @@ void AutocompleteEditModel::Observe(NotificationType type,
// the OS DNS cache could suffer eviction problems for minimal gain.
is_keyword_hint = popup_->GetKeywordForMatch(*match, &keyword);
- match_type = match->type;
}
- OnPopupDataChanged(inline_autocomplete_text, NULL, keyword, is_keyword_hint,
- match_type);
+ OnPopupDataChanged(inline_autocomplete_text, NULL, keyword, is_keyword_hint);
}
void AutocompleteEditModel::InternalSetUserText(const std::wstring& text) {
diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h
index 96a86c7..9f4e973 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.h
+++ b/chrome/browser/autocomplete/autocomplete_edit.h
@@ -83,14 +83,12 @@ class AutocompleteEditModel : public NotificationObserver {
const std::wstring& user_text,
const std::wstring& keyword,
bool is_keyword_hint,
- KeywordUIState keyword_ui_state,
- bool show_search_hint)
+ KeywordUIState keyword_ui_state)
: user_input_in_progress(user_input_in_progress),
user_text(user_text),
keyword(keyword),
is_keyword_hint(is_keyword_hint),
- keyword_ui_state(keyword_ui_state),
- show_search_hint(show_search_hint) {
+ keyword_ui_state(keyword_ui_state) {
}
bool user_input_in_progress;
@@ -98,7 +96,6 @@ class AutocompleteEditModel : public NotificationObserver {
const std::wstring keyword;
const bool is_keyword_hint;
const KeywordUIState keyword_ui_state;
- const bool show_search_hint;
};
AutocompleteEditModel(AutocompleteEditView* view,
@@ -223,10 +220,6 @@ class AutocompleteEditModel : public NotificationObserver {
// currently visible in the edit.
void ClearKeyword(const std::wstring& visible_text);
- // True if we should show the "Type to search" hint (see comments on
- // show_search_hint_).
- bool show_search_hint() const { return show_search_hint_; }
-
// Returns true if a query to an autocomplete provider is currently
// in progress. This logic should in the future live in
// AutocompleteController but resides here for now. This method is used by
@@ -272,15 +265,11 @@ class AutocompleteEditModel : public NotificationObserver {
// |keyword| is the keyword to show a hint for if |is_keyword_hint| is true,
// or the currently selected keyword if |is_keyword_hint| is false (see
// comments on keyword_ and is_keyword_hint_).
- // |type| is the type of match selected; this is used to determine whether
- // we can show the "Type to search" hint (see comments on
- // show_search_hint_).
void OnPopupDataChanged(
const std::wstring& text,
GURL* destination_for_temporary_text_change,
const std::wstring& keyword,
- bool is_keyword_hint,
- AutocompleteMatch::Type type);
+ bool is_keyword_hint);
// Called by the AutocompleteEditView after something changes, with details
// about what state changes occured. Updates internal state, updates the
@@ -432,10 +421,6 @@ class AutocompleteEditModel : public NotificationObserver {
// See KeywordUIState enum.
KeywordUIState keyword_ui_state_;
- // True when it's safe to show a "Type to search" hint to the user (when the
- // edit is empty, or the user is in the process of searching).
- bool show_search_hint_;
-
// Paste And Go-related state. See CanPasteAndGo().
mutable GURL paste_and_go_url_;
mutable PageTransition::Type paste_and_go_transition_;
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index ea49b8e..563b18e 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -127,7 +127,7 @@ void ClipboardSelectionCleared(GtkClipboard* clipboard,
if (!gtk_text_iter_equal(&insert, &selection_bound)) {
gtk_text_buffer_move_mark(buffer,
- gtk_text_buffer_get_selection_bound (buffer),
+ gtk_text_buffer_get_selection_bound(buffer),
&insert);
}
}
@@ -423,7 +423,8 @@ std::wstring AutocompleteEditViewGtk::GetText() const {
}
bool AutocompleteEditViewGtk::IsEditingOrEmpty() const {
- return (model_->user_input_in_progress() || model_->show_search_hint());
+ return model_->user_input_in_progress() ||
+ (gtk_text_buffer_get_char_count(text_buffer_) == 0);
}
int AutocompleteEditViewGtk::GetIcon() const {
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index 70239ab..61ff69dd 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -138,8 +138,6 @@ NSImage* AutocompleteEditViewMac::ImageForResource(int resource_id) {
case IDR_OMNIBOX_MORE: image_name = @"omnibox_more.pdf"; break;
// Values from |ToolbarModel::GetIcon()|.
- case IDR_OMNIBOX_HTTPS_GREEN:
- image_name = @"omnibox_https_green.pdf"; break;
case IDR_OMNIBOX_HTTPS_VALID:
image_name = @"omnibox_https_valid.pdf"; break;
case IDR_OMNIBOX_HTTPS_WARNING:
@@ -308,7 +306,8 @@ std::wstring AutocompleteEditViewMac::GetText() const {
}
bool AutocompleteEditViewMac::IsEditingOrEmpty() const {
- return (model_->user_input_in_progress() || model_->show_search_hint());
+ return model_->user_input_in_progress() ||
+ ([[field_ stringValue] length] == 0);
}
int AutocompleteEditViewMac::GetIcon() const {
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index 45386c4..5a0632f 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -599,7 +599,7 @@ std::wstring AutocompleteEditViewWin::GetText() const {
}
bool AutocompleteEditViewWin::IsEditingOrEmpty() const {
- return (model_->user_input_in_progress() || model_->show_search_hint());
+ return model_->user_input_in_progress() || (GetTextLength() == 0);
}
int AutocompleteEditViewWin::GetIcon() const {
@@ -1372,15 +1372,6 @@ void AutocompleteEditViewWin::OnKillFocus(HWND focus_wnd) {
ScopedFreeze freeze(this, GetTextObjectModel());
DefWindowProc(WM_KILLFOCUS, reinterpret_cast<WPARAM>(focus_wnd), 0);
- // Hide the "Type to search" hint if necessary. We do this after calling
- // DefWindowProc() because processing the resulting IME messages may notify
- // the controller that input is in progress, which could cause the visible
- // hints to change. (I don't know if there's a real scenario where they
- // actually do change, but this is safest.)
- if (model_->show_search_hint() ||
- (model_->is_keyword_hint() && !model_->keyword().empty()))
- controller_->OnChanged();
-
// Cancel any user selection and scroll the text back to the beginning of the
// URL. We have to do this after calling DefWindowProc() because otherwise
// an in-progress IME composition will be completed at the new caret position,
@@ -1690,12 +1681,6 @@ void AutocompleteEditViewWin::OnSetFocus(HWND focus_wnd) {
model_->OnSetFocus(GetKeyState(VK_CONTROL) < 0);
- // Notify controller if it needs to show hint UI of some kind.
- ScopedFreeze freeze(this, GetTextObjectModel());
- if (model_->show_search_hint() ||
- (model_->is_keyword_hint() && !model_->keyword().empty()))
- controller_->OnChanged();
-
// Restore saved selection if available.
if (saved_selection_for_focus_change_.cpMin != -1) {
SetSelectionRange(saved_selection_for_focus_change_);
diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.cc b/chrome/browser/autocomplete/autocomplete_popup_model.cc
index 5939b64..009cc0b 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_model.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup_model.cc
@@ -129,10 +129,10 @@ void AutocompletePopupModel::SetSelectedLine(size_t line,
match.fill_into_edit.substr(match.inline_autocomplete_offset);
}
edit_model_->OnPopupDataChanged(inline_autocomplete_text, NULL,
- keyword, is_keyword_hint, match.type);
+ keyword, is_keyword_hint);
} else {
edit_model_->OnPopupDataChanged(match.fill_into_edit, &current_destination,
- keyword, is_keyword_hint, match.type);
+ keyword, is_keyword_hint);
}
// Repaint old and new selected lines immediately, so that the edit doesn't