OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/omnibox/omnibox_edit_controller.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
6 | 6 |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/command_updater.h" | 8 #include "chrome/browser/command_updater.h" |
9 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 9 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
10 | 10 |
11 void OmniboxEditController::OnAutocompleteAccept( | 11 void OmniboxEditController::OnAutocompleteAccept( |
12 const GURL& destination_url, | 12 const GURL& destination_url, |
13 WindowOpenDisposition disposition, | 13 WindowOpenDisposition disposition, |
14 content::PageTransition transition) { | 14 ui::PageTransition transition) { |
15 destination_url_ = destination_url; | 15 destination_url_ = destination_url; |
16 disposition_ = disposition; | 16 disposition_ = disposition; |
17 transition_ = transition; | 17 transition_ = transition; |
18 if (command_updater_) | 18 if (command_updater_) |
19 command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL); | 19 command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL); |
20 } | 20 } |
21 | 21 |
22 OmniboxEditController::OmniboxEditController(CommandUpdater* command_updater) | 22 OmniboxEditController::OmniboxEditController(CommandUpdater* command_updater) |
23 : command_updater_(command_updater), | 23 : command_updater_(command_updater), |
24 disposition_(CURRENT_TAB), | 24 disposition_(CURRENT_TAB), |
25 transition_(content::PageTransitionFromInt( | 25 transition_(ui::PageTransitionFromInt( |
26 content::PAGE_TRANSITION_TYPED | | 26 ui::PAGE_TRANSITION_TYPED | |
27 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)) { | 27 ui::PAGE_TRANSITION_FROM_ADDRESS_BAR)) { |
28 } | 28 } |
29 | 29 |
30 void OmniboxEditController::HideOriginChip() { | 30 void OmniboxEditController::HideOriginChip() { |
31 GetToolbarModel()->set_origin_chip_enabled(false); | 31 GetToolbarModel()->set_origin_chip_enabled(false); |
32 OnChanged(); | 32 OnChanged(); |
33 } | 33 } |
34 | 34 |
35 void OmniboxEditController::ShowOriginChip() { | 35 void OmniboxEditController::ShowOriginChip() { |
36 // If URL replacement is still enabled, we can simply show the chip. If it | 36 // If URL replacement is still enabled, we can simply show the chip. If it |
37 // was disabled by an action to show the URL then the URL needs to be hidden. | 37 // was disabled by an action to show the URL then the URL needs to be hidden. |
38 if (GetToolbarModel()->url_replacement_enabled()) { | 38 if (GetToolbarModel()->url_replacement_enabled()) { |
39 GetToolbarModel()->set_origin_chip_enabled(true); | 39 GetToolbarModel()->set_origin_chip_enabled(true); |
40 OnChanged(); | 40 OnChanged(); |
41 } else { | 41 } else { |
42 HideURL(); | 42 HideURL(); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 OmniboxEditController::~OmniboxEditController() { | 46 OmniboxEditController::~OmniboxEditController() { |
47 } | 47 } |
OLD | NEW |