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

Unified Diff: chrome/browser/ui/views/download/download_item_view.h

Issue 2556573002: Fix SizeLabelToMinWidth() function such that no unnecessary space (Closed)
Patch Set: change to static function Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/download/download_item_view.h
diff --git a/chrome/browser/ui/views/download/download_item_view.h b/chrome/browser/ui/views/download/download_item_view.h
index 1b4db80a90d7b12e584ee5b5480cd4e46dad3748..1de1018caf1791ebda16c00e5397ffae68a2665b 100644
--- a/chrome/browser/ui/views/download/download_item_view.h
+++ b/chrome/browser/ui/views/download/download_item_view.h
@@ -136,6 +136,13 @@ class DownloadItemView : public views::InkDropHostView,
void OnBlur() override;
private:
+ FRIEND_TEST_ALL_PREFIXES(DownloadItemViewDangerousDownloadLabelTest,
+ AdjustTextAndGetSize_VeryShortText);
+ FRIEND_TEST_ALL_PREFIXES(DownloadItemViewDangerousDownloadLabelTest,
+ AdjustTextAndGetSize_MoreTextOnFirstLine);
+ FRIEND_TEST_ALL_PREFIXES(DownloadItemViewDangerousDownloadLabelTest,
+ AdjustTextAndGetSize_VeryLongTextWithoutSpace);
Peter Kasting 2016/12/08 21:53:52 Nit: No strong feeling here, but if you had a sing
Jialiu Lin 2016/12/08 22:44:03 merged into a single test case.
+
enum State { NORMAL = 0, HOT, PUSHED };
class DropDownButton;
@@ -197,7 +204,7 @@ class DownloadItemView : public views::InkDropHostView,
// Reverts from dangerous mode to normal download mode.
void ClearWarningDialog();
- // Start displaying the dangerous download warning or the malicious download
+ // Starts displaying the dangerous download warning or the malicious download
// warning.
void ShowWarningDialog();
@@ -214,6 +221,10 @@ class DownloadItemView : public views::InkDropHostView,
// and simply returned on subsequent calls.
void SizeLabelToMinWidth();
+ // Called by SizeLabelToMinWidth() to compute the optimal size (a.k.a minimum
+ // width) of a label and set its text accordingly.
Peter Kasting 2016/12/08 21:53:52 Nit: Maybe more detail would help, especially for
Jialiu Lin 2016/12/08 22:44:03 Done.
+ static gfx::Size AdjustTextAndGetSize(views::Label* label);
+
// Reenables the item after it has been disabled when a user clicked it to
// open the downloaded file.
void Reenable();

Powered by Google App Engine
This is Rietveld 408576698