| 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/views/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" | 24 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" |
| 25 #include "chrome/grit/generated_resources.h" | 25 #include "chrome/grit/generated_resources.h" |
| 26 #include "components/bookmarks/browser/bookmark_node_data.h" | 26 #include "components/bookmarks/browser/bookmark_node_data.h" |
| 27 #include "components/omnibox/browser/autocomplete_input.h" | 27 #include "components/omnibox/browser/autocomplete_input.h" |
| 28 #include "components/omnibox/browser/autocomplete_match.h" | 28 #include "components/omnibox/browser/autocomplete_match.h" |
| 29 #include "components/omnibox/browser/omnibox_edit_controller.h" | 29 #include "components/omnibox/browser/omnibox_edit_controller.h" |
| 30 #include "components/omnibox/browser/omnibox_edit_model.h" | 30 #include "components/omnibox/browser/omnibox_edit_model.h" |
| 31 #include "components/omnibox/browser/omnibox_field_trial.h" | 31 #include "components/omnibox/browser/omnibox_field_trial.h" |
| 32 #include "components/omnibox/browser/omnibox_popup_model.h" | 32 #include "components/omnibox/browser/omnibox_popup_model.h" |
| 33 #include "components/search/search.h" | 33 #include "components/search/search.h" |
| 34 #include "components/toolbar/toolbar_model.h" |
| 34 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
| 35 #include "extensions/common/constants.h" | 36 #include "extensions/common/constants.h" |
| 36 #include "net/base/escape.h" | 37 #include "net/base/escape.h" |
| 37 #include "third_party/skia/include/core/SkColor.h" | 38 #include "third_party/skia/include/core/SkColor.h" |
| 38 #include "ui/accessibility/ax_view_state.h" | 39 #include "ui/accessibility/ax_view_state.h" |
| 39 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 40 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 40 #include "ui/base/dragdrop/drag_drop_types.h" | 41 #include "ui/base/dragdrop/drag_drop_types.h" |
| 41 #include "ui/base/dragdrop/os_exchange_data.h" | 42 #include "ui/base/dragdrop/os_exchange_data.h" |
| 42 #include "ui/base/ime/input_method.h" | 43 #include "ui/base/ime/input_method.h" |
| 43 #include "ui/base/ime/text_input_client.h" | 44 #include "ui/base/ime/text_input_client.h" |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 model()->OnUpOrDownKeyPressed(event.IsShiftDown() ? -1 : 1); | 430 model()->OnUpOrDownKeyPressed(event.IsShiftDown() ? -1 : 1); |
| 430 | 431 |
| 431 return true; | 432 return true; |
| 432 } | 433 } |
| 433 | 434 |
| 434 void OmniboxViewViews::AccessibilitySetValue(const base::string16& new_value) { | 435 void OmniboxViewViews::AccessibilitySetValue(const base::string16& new_value) { |
| 435 SetUserText(new_value, new_value, true); | 436 SetUserText(new_value, new_value, true); |
| 436 } | 437 } |
| 437 | 438 |
| 438 void OmniboxViewViews::UpdateSecurityLevel() { | 439 void OmniboxViewViews::UpdateSecurityLevel() { |
| 439 ChromeToolbarModel* chrome_toolbar_model = | 440 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); |
| 440 static_cast<ChromeToolbarModel*>(controller()->GetToolbarModel()); | |
| 441 security_level_ = chrome_toolbar_model->GetSecurityLevel(false); | |
| 442 } | 441 } |
| 443 | 442 |
| 444 void OmniboxViewViews::SetWindowTextAndCaretPos(const base::string16& text, | 443 void OmniboxViewViews::SetWindowTextAndCaretPos(const base::string16& text, |
| 445 size_t caret_pos, | 444 size_t caret_pos, |
| 446 bool update_popup, | 445 bool update_popup, |
| 447 bool notify_text_changed) { | 446 bool notify_text_changed) { |
| 448 const gfx::Range range(caret_pos, caret_pos); | 447 const gfx::Range range(caret_pos, caret_pos); |
| 449 SetTextAndSelectedRange(text, range); | 448 SetTextAndSelectedRange(text, range); |
| 450 | 449 |
| 451 if (update_popup) | 450 if (update_popup) |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 menu_contents->InsertItemWithStringIdAt( | 1073 menu_contents->InsertItemWithStringIdAt( |
| 1075 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | 1074 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); |
| 1076 } | 1075 } |
| 1077 | 1076 |
| 1078 // Minor note: We use IDC_ for command id here while the underlying textfield | 1077 // Minor note: We use IDC_ for command id here while the underlying textfield |
| 1079 // is using IDS_ for all its command ids. This is because views cannot depend | 1078 // is using IDS_ for all its command ids. This is because views cannot depend |
| 1080 // on IDC_ for now. | 1079 // on IDC_ for now. |
| 1081 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1080 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
| 1082 IDS_EDIT_SEARCH_ENGINES); | 1081 IDS_EDIT_SEARCH_ENGINES); |
| 1083 } | 1082 } |
| OLD | NEW |