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

Side by Side Diff: components/enhanced_bookmarks/enhanced_bookmark_utils.cc

Issue 1143153010: [Android] Add enhanced bookmarks grid/list view experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: indent fix Created 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/enhanced_bookmarks/enhanced_bookmark_utils.h" 5 #include "components/enhanced_bookmarks/enhanced_bookmark_utils.h"
6 6
7 #include "components/bookmarks/browser/bookmark_model.h" 7 #include "components/bookmarks/browser/bookmark_model.h"
8 #include "components/variations/variations_associated_data.h"
8 9
9 using bookmarks::BookmarkModel; 10 using bookmarks::BookmarkModel;
10 using bookmarks::BookmarkNode; 11 using bookmarks::BookmarkNode;
11 12
12 namespace enhanced_bookmarks { 13 namespace enhanced_bookmarks {
13 14
15 const char kFieldTrialName[] = "EnhancedBookmarks";
16
14 std::vector<const BookmarkNode*> PrimaryPermanentNodes(BookmarkModel* model) { 17 std::vector<const BookmarkNode*> PrimaryPermanentNodes(BookmarkModel* model) {
15 DCHECK(model->loaded()); 18 DCHECK(model->loaded());
16 std::vector<const BookmarkNode*> nodes; 19 std::vector<const BookmarkNode*> nodes;
17 nodes.push_back(model->mobile_node()); 20 nodes.push_back(model->mobile_node());
18 nodes.push_back(model->bookmark_bar_node()); 21 nodes.push_back(model->bookmark_bar_node());
19 nodes.push_back(model->other_node()); 22 nodes.push_back(model->other_node());
20 return nodes; 23 return nodes;
21 } 24 }
22 25
23 std::vector<const BookmarkNode*> RootLevelFolders(BookmarkModel* model) { 26 std::vector<const BookmarkNode*> RootLevelFolders(BookmarkModel* model) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 const std::vector<const BookmarkNode*> root_folders(RootLevelFolders(model)); 59 const std::vector<const BookmarkNode*> root_folders(RootLevelFolders(model));
57 const BookmarkNode* top = node; 60 const BookmarkNode* top = node;
58 while (top && 61 while (top &&
59 std::find(root_folders.begin(), root_folders.end(), top) == 62 std::find(root_folders.begin(), root_folders.end(), top) ==
60 root_folders.end()) { 63 root_folders.end()) {
61 top = top->parent(); 64 top = top->parent();
62 } 65 }
63 return top; 66 return top;
64 } 67 }
65 68
69 ViewMode GetDefaultViewMode() {
70 std::string default_view_mode = variations::GetVariationParamValue(
71 enhanced_bookmarks::kFieldTrialName, "DefaultViewMode");
72
73 if (default_view_mode == "List") return ViewMode::LIST;
74
75 // Below line was ommitted because the default is ViewMode::GRID anyways.
76 // if (default_view_mode == "Grid") return ViewMode::GRID;
Theresa 2015/05/28 20:13:08 If we change the default to list (or something els
Kibeom Kim (inactive) 2015/05/29 00:11:04 Sorry. The comment and the structure was confusing
77
78 return ViewMode::GRID;
79 }
80
66 } // namespace enhanced_bookmarks 81 } // namespace enhanced_bookmarks
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698