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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_result_view.cc

Issue 1550053002: Convert Pass()→std::move() in //chrome/browser/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 // For WinDDK ATL compatibility, these ATL headers must come first. 5 // For WinDDK ATL compatibility, these ATL headers must come first.
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <atlbase.h> // NOLINT 8 #include <atlbase.h> // NOLINT
9 #include <atlwin.h> // NOLINT 9 #include <atlwin.h> // NOLINT
10 #endif 10 #endif
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 465 }
466 466
467 scoped_ptr<gfx::RenderText> OmniboxResultView::CreateRenderText( 467 scoped_ptr<gfx::RenderText> OmniboxResultView::CreateRenderText(
468 const base::string16& text) const { 468 const base::string16& text) const {
469 scoped_ptr<gfx::RenderText> render_text(gfx::RenderText::CreateInstance()); 469 scoped_ptr<gfx::RenderText> render_text(gfx::RenderText::CreateInstance());
470 render_text->SetDisplayRect(gfx::Rect(gfx::Size(INT_MAX, 0))); 470 render_text->SetDisplayRect(gfx::Rect(gfx::Size(INT_MAX, 0)));
471 render_text->SetCursorEnabled(false); 471 render_text->SetCursorEnabled(false);
472 render_text->SetElideBehavior(gfx::ELIDE_TAIL); 472 render_text->SetElideBehavior(gfx::ELIDE_TAIL);
473 render_text->SetFontList(font_list_); 473 render_text->SetFontList(font_list_);
474 render_text->SetText(text); 474 render_text->SetText(text);
475 return render_text.Pass(); 475 return render_text;
476 } 476 }
477 477
478 scoped_ptr<gfx::RenderText> OmniboxResultView::CreateClassifiedRenderText( 478 scoped_ptr<gfx::RenderText> OmniboxResultView::CreateClassifiedRenderText(
479 const base::string16& text, 479 const base::string16& text,
480 const ACMatchClassifications& classifications, 480 const ACMatchClassifications& classifications,
481 bool force_dim) const { 481 bool force_dim) const {
482 scoped_ptr<gfx::RenderText> render_text(CreateRenderText(text)); 482 scoped_ptr<gfx::RenderText> render_text(CreateRenderText(text));
483 const size_t text_length = render_text->text().length(); 483 const size_t text_length = render_text->text().length();
484 for (size_t i = 0; i < classifications.size(); ++i) { 484 for (size_t i = 0; i < classifications.size(); ++i) {
485 const size_t text_start = classifications[i].offset; 485 const size_t text_start = classifications[i].offset;
(...skipping 23 matching lines...) Expand all
509 // Also, if the URL supports https, the appearance will change into LTR 509 // Also, if the URL supports https, the appearance will change into LTR
510 // directionality. 510 // directionality.
511 // In conclusion, LTR rendering of URL is probably the safest bet. 511 // In conclusion, LTR rendering of URL is probably the safest bet.
512 render_text->SetDirectionalityMode(gfx::DIRECTIONALITY_FORCE_LTR); 512 render_text->SetDirectionalityMode(gfx::DIRECTIONALITY_FORCE_LTR);
513 } else if (force_dim || 513 } else if (force_dim ||
514 (classifications[i].style & ACMatchClassification::DIM)) { 514 (classifications[i].style & ACMatchClassification::DIM)) {
515 color_kind = DIMMED_TEXT; 515 color_kind = DIMMED_TEXT;
516 } 516 }
517 render_text->ApplyColor(GetColor(GetState(), color_kind), current_range); 517 render_text->ApplyColor(GetColor(GetState(), color_kind), current_range);
518 } 518 }
519 return render_text.Pass(); 519 return render_text;
520 } 520 }
521 521
522 int OmniboxResultView::GetMatchContentsWidth() const { 522 int OmniboxResultView::GetMatchContentsWidth() const {
523 InitContentsRenderTextIfNecessary(); 523 InitContentsRenderTextIfNecessary();
524 contents_rendertext_->SetDisplayRect(gfx::Rect(gfx::Size(INT_MAX, 0))); 524 contents_rendertext_->SetDisplayRect(gfx::Rect(gfx::Size(INT_MAX, 0)));
525 return contents_rendertext_->GetContentWidth(); 525 return contents_rendertext_->GetContentWidth();
526 } 526 }
527 527
528 void OmniboxResultView::SetAnswerImage(const gfx::ImageSkia& image) { 528 void OmniboxResultView::SetAnswerImage(const gfx::ImageSkia& image) {
529 answer_image_ = image; 529 answer_image_ = image;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 const auto* text_field = line.additional_text(); 761 const auto* text_field = line.additional_text();
762 if (text_field) { 762 if (text_field) {
763 AppendAnswerText(destination.get(), space + text_field->text(), 763 AppendAnswerText(destination.get(), space + text_field->text(),
764 text_field->type()); 764 text_field->type());
765 } 765 }
766 text_field = line.status_text(); 766 text_field = line.status_text();
767 if (text_field) { 767 if (text_field) {
768 AppendAnswerText(destination.get(), space + text_field->text(), 768 AppendAnswerText(destination.get(), space + text_field->text(),
769 text_field->type()); 769 text_field->type());
770 } 770 }
771 return destination.Pass(); 771 return destination;
772 } 772 }
773 773
774 void OmniboxResultView::AppendAnswerText(gfx::RenderText* destination, 774 void OmniboxResultView::AppendAnswerText(gfx::RenderText* destination,
775 const base::string16& text, 775 const base::string16& text,
776 int text_type) { 776 int text_type) {
777 // TODO(dschuyler): make this better. Right now this only supports unnested 777 // TODO(dschuyler): make this better. Right now this only supports unnested
778 // bold tags. In the future we'll need to flag unexpected tags while adding 778 // bold tags. In the future we'll need to flag unexpected tags while adding
779 // support for b, i, u, sub, and sup. We'll also need to support HTML 779 // support for b, i, u, sub, and sup. We'll also need to support HTML
780 // entities (&lt; for '<', etc.). 780 // entities (&lt; for '<', etc.).
781 const base::string16 begin_tag = base::ASCIIToUTF16("<b>"); 781 const base::string16 begin_tag = base::ASCIIToUTF16("<b>");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 819
820 int OmniboxResultView::StartMargin() const { 820 int OmniboxResultView::StartMargin() const {
821 return ui::MaterialDesignController::IsModeMaterial() ? 821 return ui::MaterialDesignController::IsModeMaterial() ?
822 model_->start_margin() : 0; 822 model_->start_margin() : 0;
823 } 823 }
824 824
825 int OmniboxResultView::EndMargin() const { 825 int OmniboxResultView::EndMargin() const {
826 return ui::MaterialDesignController::IsModeMaterial() ? 826 return ui::MaterialDesignController::IsModeMaterial() ?
827 model_->end_margin() : 0; 827 model_->end_margin() : 0;
828 } 828 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/infobar_view.cc ('k') | chrome/browser/ui/views/panels/panel_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698