OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/webui/snippets_internals_message_handler.h" | 5 #include "chrome/browser/ui/webui/snippets_internals_message_handler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 entry->SetString("id", "content-suggestion-" + base::IntToString(index)); | 73 entry->SetString("id", "content-suggestion-" + base::IntToString(index)); |
74 return entry; | 74 return entry; |
75 } | 75 } |
76 | 76 |
77 std::string MapCategoryName(ContentSuggestionsCategory category) { | 77 std::string MapCategoryName(ContentSuggestionsCategory category) { |
78 switch (category) { | 78 switch (category) { |
79 case ContentSuggestionsCategory::ARTICLES: | 79 case ContentSuggestionsCategory::ARTICLES: |
80 return "Articles"; | 80 return "Articles"; |
81 case ContentSuggestionsCategory::OFFLINE_PAGES: | 81 case ContentSuggestionsCategory::OFFLINE_PAGES: |
82 return "Offline pages (continue browsing)"; | 82 return "Offline pages (continue browsing)"; |
| 83 case ContentSuggestionsCategory::BOOKMARKS: |
| 84 return "Recently visited bookmarks"; |
83 case ContentSuggestionsCategory::COUNT: | 85 case ContentSuggestionsCategory::COUNT: |
84 NOTREACHED() << "Category::COUNT must not be used as a value"; | 86 NOTREACHED() << "Category::COUNT must not be used as a value"; |
85 } | 87 } |
86 return std::string(); | 88 return std::string(); |
87 } | 89 } |
88 | 90 |
89 std::string MapCategoryStatus(ContentSuggestionsCategoryStatus status) { | 91 std::string MapCategoryStatus(ContentSuggestionsCategoryStatus status) { |
90 switch (status) { | 92 switch (status) { |
91 case ContentSuggestionsCategoryStatus::INITIALIZING: | 93 case ContentSuggestionsCategoryStatus::INITIALIZING: |
92 return "INITIALIZING"; | 94 return "INITIALIZING"; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } | 376 } |
375 | 377 |
376 void SnippetsInternalsMessageHandler::SendString(const std::string& name, | 378 void SnippetsInternalsMessageHandler::SendString(const std::string& name, |
377 const std::string& value) { | 379 const std::string& value) { |
378 base::StringValue string_name(name); | 380 base::StringValue string_name(name); |
379 base::StringValue string_value(value); | 381 base::StringValue string_value(value); |
380 | 382 |
381 web_ui()->CallJavascriptFunctionUnsafe( | 383 web_ui()->CallJavascriptFunctionUnsafe( |
382 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); | 384 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); |
383 } | 385 } |
OLD | NEW |