Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Read Later omnibox star entry point.
Add a new menu triggered by the StarView which gives the option to either bookmark the tab or save it for later. If bookmark is selected the user flow matches previous behavior. If save to read later is selected the tab will be saved to the reading list model. Note this change is hidden behind the read later feature flag. Follow-up work: Update the read later icon in the menu when new icons are available. Update the omnibox star tooltip. Update StarView/bookmark metrics and add metrics for read later. Update menu size. Bug: 1117023 Change-Id: I09c6cf4973338faa272bc6ec6da06e26f0f9aa8f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2359550 Commit-Queue: Caroline Rising <corising@chromium.org> Reviewed-by: Peter Boström <pbos@chromium.org> Reviewed-by: Connie Wan <connily@chromium.org> Cr-Commit-Position: refs/heads/master@{#801449}
- Loading branch information
Caroline Rising
authored and
Commit Bot
committed
Aug 25, 2020
1 parent
091a827
commit 36929b5
Showing
14 changed files
with
322 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
chrome/app/generated_resources_grd/IDS_STAR_VIEW_MENU_ADD_BOOKMARK.png.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cd19bd38c1c505428e1b952dff29ea2dcc23a749 |
1 change: 1 addition & 0 deletions
1
chrome/app/generated_resources_grd/IDS_STAR_VIEW_MENU_EDIT_BOOKMARK.png.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ca95daa02a7ba6b6dcc742fa2359f58058ac8025 |
1 change: 1 addition & 0 deletions
1
chrome/app/generated_resources_grd/IDS_STAR_VIEW_MENU_MARK_AS_READ.png.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ca95daa02a7ba6b6dcc742fa2359f58058ac8025 |
1 change: 1 addition & 0 deletions
1
chrome/app/generated_resources_grd/IDS_STAR_VIEW_MENU_MOVE_TO_READ_LATER.png.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cd19bd38c1c505428e1b952dff29ea2dcc23a749 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2020 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/ui/views/location_bar/star_menu_model.h" | ||
|
||
#include "chrome/grit/generated_resources.h" | ||
#include "components/omnibox/browser/vector_icons.h" | ||
#include "components/vector_icons/vector_icons.h" | ||
#include "ui/base/models/image_model.h" | ||
|
||
StarMenuModel::StarMenuModel(ui::SimpleMenuModel::Delegate* delegate, | ||
bool bookmarked, | ||
bool exists_as_unread_in_read_later) | ||
: SimpleMenuModel(delegate) { | ||
Build(bookmarked, exists_as_unread_in_read_later); | ||
} | ||
|
||
StarMenuModel::~StarMenuModel() = default; | ||
|
||
void StarMenuModel::Build(bool bookmarked, | ||
bool exists_as_unread_in_read_later) { | ||
AddItemWithStringIdAndIcon( | ||
CommandBookmark, | ||
bookmarked ? IDS_STAR_VIEW_MENU_EDIT_BOOKMARK | ||
: IDS_STAR_VIEW_MENU_ADD_BOOKMARK, | ||
ui::ImageModel::FromVectorIcon(omnibox::kStarIcon)); | ||
// TODO(corising): Replace placeholder folder icon with read-later icon once | ||
// available. | ||
AddItemWithStringIdAndIcon( | ||
exists_as_unread_in_read_later ? CommandMarkAsRead | ||
: CommandMoveToReadLater, | ||
exists_as_unread_in_read_later ? IDS_STAR_VIEW_MENU_MARK_AS_READ | ||
: IDS_STAR_VIEW_MENU_MOVE_TO_READ_LATER, | ||
ui::ImageModel::FromVectorIcon(vector_icons::kFolderIcon)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2020 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_MENU_MODEL_H_ | ||
#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_MENU_MODEL_H_ | ||
|
||
#include "base/macros.h" | ||
#include "ui/base/models/simple_menu_model.h" | ||
|
||
class StarMenuModel : public ui::SimpleMenuModel { | ||
public: | ||
StarMenuModel(ui::SimpleMenuModel::Delegate* delegate, | ||
bool bookmarked, | ||
bool exists_as_unread_in_read_later); | ||
StarMenuModel(const StarMenuModel&) = delete; | ||
StarMenuModel& operator=(const StarMenuModel&) = delete; | ||
~StarMenuModel() override; | ||
|
||
enum StarMenuCommand { | ||
CommandBookmark, | ||
CommandMoveToReadLater, | ||
CommandMarkAsRead | ||
}; | ||
|
||
private: | ||
void Build(bool bookmarked, bool exists_as_unread_in_read_later); | ||
}; | ||
|
||
#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_MENU_MODEL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.