Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 320253004: Componentize URLFixerUpper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win64 fix Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/omnibox/omnibox_edit_model.h" 5 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.h" 46 #include "chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.h"
47 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" 47 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
48 #include "chrome/browser/ui/omnibox/omnibox_navigation_observer.h" 48 #include "chrome/browser/ui/omnibox/omnibox_navigation_observer.h"
49 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" 49 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
50 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" 50 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h"
51 #include "chrome/browser/ui/omnibox/omnibox_view.h" 51 #include "chrome/browser/ui/omnibox/omnibox_view.h"
52 #include "chrome/browser/ui/search/instant_search_prerenderer.h" 52 #include "chrome/browser/ui/search/instant_search_prerenderer.h"
53 #include "chrome/browser/ui/search/search_tab_helper.h" 53 #include "chrome/browser/ui/search/search_tab_helper.h"
54 #include "chrome/browser/ui/toolbar/toolbar_model.h" 54 #include "chrome/browser/ui/toolbar/toolbar_model.h"
55 #include "chrome/common/chrome_switches.h" 55 #include "chrome/common/chrome_switches.h"
56 #include "chrome/common/net/url_fixer_upper.h"
57 #include "chrome/common/pref_names.h" 56 #include "chrome/common/pref_names.h"
58 #include "chrome/common/url_constants.h" 57 #include "chrome/common/url_constants.h"
59 #include "components/google/core/browser/google_url_tracker.h" 58 #include "components/google/core/browser/google_url_tracker.h"
59 #include "components/url_fixer/url_fixer.h"
60 #include "content/public/browser/navigation_controller.h" 60 #include "content/public/browser/navigation_controller.h"
61 #include "content/public/browser/navigation_entry.h" 61 #include "content/public/browser/navigation_entry.h"
62 #include "content/public/browser/notification_service.h" 62 #include "content/public/browser/notification_service.h"
63 #include "content/public/browser/render_view_host.h" 63 #include "content/public/browser/render_view_host.h"
64 #include "content/public/browser/user_metrics.h" 64 #include "content/public/browser/user_metrics.h"
65 #include "extensions/common/constants.h" 65 #include "extensions/common/constants.h"
66 #include "ui/gfx/image/image.h" 66 #include "ui/gfx/image/image.h"
67 #include "url/url_util.h" 67 #include "url/url_util.h"
68 68
69 using predictors::AutocompleteActionPredictor; 69 using predictors::AutocompleteActionPredictor;
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 !(popup_model() && popup_model()->IsOpen()) && 325 !(popup_model() && popup_model()->IsOpen()) &&
326 controller_->GetToolbarModel()->url_replacement_enabled())) && 326 controller_->GetToolbarModel()->url_replacement_enabled())) &&
327 (gray_text.empty() || 327 (gray_text.empty() ||
328 new_permanent_text != user_text_ + gray_text); 328 new_permanent_text != user_text_ + gray_text);
329 329
330 permanent_text_ = new_permanent_text; 330 permanent_text_ = new_permanent_text;
331 return visibly_changed_permanent_text; 331 return visibly_changed_permanent_text;
332 } 332 }
333 333
334 GURL OmniboxEditModel::PermanentURL() { 334 GURL OmniboxEditModel::PermanentURL() {
335 return URLFixerUpper::FixupURL(base::UTF16ToUTF8(permanent_text_), 335 return url_fixer::FixupURL(base::UTF16ToUTF8(permanent_text_), std::string());
336 std::string());
337 } 336 }
338 337
339 void OmniboxEditModel::SetUserText(const base::string16& text) { 338 void OmniboxEditModel::SetUserText(const base::string16& text) {
340 SetInputInProgress(true); 339 SetInputInProgress(true);
341 InternalSetUserText(text); 340 InternalSetUserText(text);
342 omnibox_controller_->InvalidateCurrentMatch(); 341 omnibox_controller_->InvalidateCurrentMatch();
343 paste_state_ = NONE; 342 paste_state_ = NONE;
344 has_temporary_text_ = false; 343 has_temporary_text_ = false;
345 } 344 }
346 345
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 // Update state and notify view if the omnibox has focus and the caret 1466 // Update state and notify view if the omnibox has focus and the caret
1468 // visibility changed. 1467 // visibility changed.
1469 const bool was_caret_visible = is_caret_visible(); 1468 const bool was_caret_visible = is_caret_visible();
1470 focus_state_ = state; 1469 focus_state_ = state;
1471 if (focus_state_ != OMNIBOX_FOCUS_NONE && 1470 if (focus_state_ != OMNIBOX_FOCUS_NONE &&
1472 is_caret_visible() != was_caret_visible) 1471 is_caret_visible() != was_caret_visible)
1473 view_->ApplyCaretVisibility(); 1472 view_->ApplyCaretVisibility();
1474 1473
1475 delegate_->OnFocusChanged(focus_state_, reason); 1474 delegate_->OnFocusChanged(focus_state_, reason);
1476 } 1475 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698