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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 // TODO(pke): Replace this as soon as the service delivers the title directly. | 78 // TODO(pke): Replace this as soon as the service delivers the title directly. |
79 std::string GetCategoryTitle(Category category) { | 79 std::string GetCategoryTitle(Category category) { |
80 if (category.IsKnownCategory(KnownCategories::ARTICLES)) { | 80 if (category.IsKnownCategory(KnownCategories::ARTICLES)) { |
81 return "Articles"; | 81 return "Articles"; |
82 } | 82 } |
83 if (category.IsKnownCategory(KnownCategories::OFFLINE_PAGES)) { | 83 if (category.IsKnownCategory(KnownCategories::OFFLINE_PAGES)) { |
84 return "Offline pages (continue browsing)"; | 84 return "Offline pages (continue browsing)"; |
85 } | 85 } |
| 86 if (category.IsKnownCategory(KnownCategories::BOOKMARKS)) { |
| 87 return "Recently visited bookmarks"; |
| 88 } |
86 return std::string(); | 89 return std::string(); |
87 } | 90 } |
88 | 91 |
89 std::string GetCategoryStatusName(CategoryStatus status) { | 92 std::string GetCategoryStatusName(CategoryStatus status) { |
90 switch (status) { | 93 switch (status) { |
91 case CategoryStatus::INITIALIZING: | 94 case CategoryStatus::INITIALIZING: |
92 return "INITIALIZING"; | 95 return "INITIALIZING"; |
93 case CategoryStatus::AVAILABLE: | 96 case CategoryStatus::AVAILABLE: |
94 return "AVAILABLE"; | 97 return "AVAILABLE"; |
95 case CategoryStatus::AVAILABLE_LOADING: | 98 case CategoryStatus::AVAILABLE_LOADING: |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 } | 355 } |
353 | 356 |
354 void SnippetsInternalsMessageHandler::SendString(const std::string& name, | 357 void SnippetsInternalsMessageHandler::SendString(const std::string& name, |
355 const std::string& value) { | 358 const std::string& value) { |
356 base::StringValue string_name(name); | 359 base::StringValue string_name(name); |
357 base::StringValue string_value(value); | 360 base::StringValue string_value(value); |
358 | 361 |
359 web_ui()->CallJavascriptFunctionUnsafe( | 362 web_ui()->CallJavascriptFunctionUnsafe( |
360 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); | 363 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); |
361 } | 364 } |
OLD | NEW |