| Index: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
|
| diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
|
| index ac87f9e73b3c834bf689fad11d4c21aa1dfa0e1e..a0498b94fc851e3ce2815fe21dbb81fc498dc6cd 100644
|
| --- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
|
| +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
|
| @@ -14,6 +14,7 @@
|
| #include "chrome/browser/autocomplete/autocomplete_input.h"
|
| #include "chrome/browser/autocomplete/autocomplete_match.h"
|
| #include "chrome/browser/browser_process.h"
|
| +#include "chrome/browser/search/search.h"
|
| #include "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
|
| #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
|
| #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h"
|
| @@ -204,6 +205,10 @@ void OmniboxViewMac::OnTabChanged(const WebContents* web_contents) {
|
| }
|
|
|
| void OmniboxViewMac::Update() {
|
| + if (chrome::ShouldDisplayOriginChipV2()) {
|
| + [[field_ cell] setPlaceholderString:
|
| + base::SysUTF16ToNSString(GetHintText())];
|
| + }
|
| if (model()->UpdatePermanentText()) {
|
| // Something visibly changed. Re-enable URL replacement.
|
| controller()->GetToolbarModel()->set_url_replacement_enabled(true);
|
| @@ -769,12 +774,32 @@ bool OmniboxViewMac::OnDoCommandBySelector(SEL cmd) {
|
| void OmniboxViewMac::OnSetFocus(bool control_down) {
|
| model()->OnSetFocus(control_down);
|
| controller()->OnSetFocus();
|
| +
|
| + // TODO(groby): Not entirely correct, since the chip should only be disabled
|
| + // after mouseDown: was handled, to allow clicking on the origin chip.
|
| + if (chrome::ShouldDisplayOriginChipV2()) {
|
| + controller()->GetToolbarModel()->set_origin_chip_enabled(false);
|
| + controller()->OnChanged();
|
| + }
|
| }
|
|
|
| void OmniboxViewMac::OnKillFocus() {
|
| // Tell the model to reset itself.
|
| model()->OnWillKillFocus(NULL);
|
| model()->OnKillFocus();
|
| +
|
| + // If user input is not in progress, re-enable the origin chip and URL
|
| + // replacement. This addresses the case where the URL was shown by a call
|
| + // to ShowURL(). If the Omnibox achieved focus by other means, the calls to
|
| + // set_url_replacement_enabled, UpdatePermanentText and RevertAll are not
|
| + // required (a call to OnChanged would be sufficient) but do no harm.
|
| + if (chrome::ShouldDisplayOriginChipV2() &&
|
| + !model()->user_input_in_progress()) {
|
| + controller()->GetToolbarModel()->set_origin_chip_enabled(true);
|
| + controller()->GetToolbarModel()->set_url_replacement_enabled(true);
|
| + model()->UpdatePermanentText();
|
| + RevertAll();
|
| + }
|
| }
|
|
|
| void OmniboxViewMac::OnMouseDown(NSInteger button_number) {
|
|
|