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

Side by Side Diff: components/omnibox/browser/omnibox_popup_model.cc

Issue 2901953002: Omnibox UI Experiments: Add Vertical Layout experiment (title-on-top). (Closed)
Patch Set: swap text in some circumstances to match mobile Created 3 years, 7 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
OLDNEW
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 "components/omnibox/browser/omnibox_popup_model.h" 5 #include "components/omnibox/browser/omnibox_popup_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/feature_list.h"
9 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
11 #include "components/bookmarks/browser/bookmark_model.h" 12 #include "components/bookmarks/browser/bookmark_model.h"
12 #include "components/omnibox/browser/autocomplete_match.h" 13 #include "components/omnibox/browser/autocomplete_match.h"
13 #include "components/omnibox/browser/omnibox_client.h" 14 #include "components/omnibox/browser/omnibox_client.h"
15 #include "components/omnibox/browser/omnibox_field_trial.h"
14 #include "components/omnibox/browser/omnibox_popup_model_observer.h" 16 #include "components/omnibox/browser/omnibox_popup_model_observer.h"
15 #include "components/omnibox/browser/omnibox_popup_view.h" 17 #include "components/omnibox/browser/omnibox_popup_view.h"
16 #include "components/search_engines/template_url.h" 18 #include "components/search_engines/template_url.h"
17 #include "components/search_engines/template_url_service.h" 19 #include "components/search_engines/template_url_service.h"
18 #include "third_party/icu/source/common/unicode/ubidi.h" 20 #include "third_party/icu/source/common/unicode/ubidi.h"
19 #include "ui/gfx/geometry/rect.h" 21 #include "ui/gfx/geometry/rect.h"
20 #include "ui/gfx/image/image.h" 22 #include "ui/gfx/image/image.h"
21 23
22 using bookmarks::BookmarkModel; 24 using bookmarks::BookmarkModel;
23 25
(...skipping 24 matching lines...) Expand all
48 bool description_on_separate_line, 50 bool description_on_separate_line,
49 bool allow_shrinking_contents, 51 bool allow_shrinking_contents,
50 int* contents_max_width, 52 int* contents_max_width,
51 int* description_max_width) { 53 int* description_max_width) {
52 available_width = std::max(available_width, 0); 54 available_width = std::max(available_width, 0);
53 *contents_max_width = std::min(contents_width, available_width); 55 *contents_max_width = std::min(contents_width, available_width);
54 *description_max_width = std::min(description_width, available_width); 56 *description_max_width = std::min(description_width, available_width);
55 57
56 // If the description is empty, or the contents and description are on 58 // If the description is empty, or the contents and description are on
57 // separate lines, each can get the full available width. 59 // separate lines, each can get the full available width.
58 if (!description_width || description_on_separate_line) 60 if (!description_width || description_on_separate_line ||
Peter Kasting 2017/05/25 20:24:39 I feel like the caller should have passed true for
tommycli 2017/05/25 21:59:10 Done.
61 base::FeatureList::IsEnabled(omnibox::kUIExperimentVerticalLayout)) {
Peter Kasting 2017/05/25 20:24:39 Nit: Omnibox code doesn't usually use braces for c
tommycli 2017/05/25 21:59:10 Done.
59 return; 62 return;
63 }
60 64
61 // If we want to display the description, we need to reserve enough space for 65 // If we want to display the description, we need to reserve enough space for
62 // the separator. 66 // the separator.
63 available_width -= separator_width; 67 available_width -= separator_width;
64 if (available_width < 0) { 68 if (available_width < 0) {
65 *description_max_width = 0; 69 *description_max_width = 0;
66 return; 70 return;
67 } 71 }
68 72
69 if (contents_width + description_width > available_width) { 73 if (contents_width + description_width > available_width) {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 298 }
295 299
296 void OmniboxPopupModel::RemoveObserver(OmniboxPopupModelObserver* observer) { 300 void OmniboxPopupModel::RemoveObserver(OmniboxPopupModelObserver* observer) {
297 observers_.RemoveObserver(observer); 301 observers_.RemoveObserver(observer);
298 } 302 }
299 303
300 void OmniboxPopupModel::SetAnswerBitmap(const SkBitmap& bitmap) { 304 void OmniboxPopupModel::SetAnswerBitmap(const SkBitmap& bitmap) {
301 answer_bitmap_ = bitmap; 305 answer_bitmap_ = bitmap;
302 view_->UpdatePopupAppearance(); 306 view_->UpdatePopupAppearance();
303 } 307 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698