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

Side by Side Diff: chrome/browser/ui/webui/snippets_internals_message_handler.cc

Issue 2061803002: 📰 The Status card reports disabled sync states (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simplifyBridge
Patch Set: yolo: another big bag of changes Created 4 years, 5 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
« no previous file with comments | « chrome/browser/ui/webui/snippets_internals_message_handler.h ('k') | components/OWNERS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (!dom_loaded_) return; 67 if (!dom_loaded_) return;
68 68
69 SendSnippets(); 69 SendSnippets();
70 70
71 web_ui()->CallJavascriptFunctionUnsafe( 71 web_ui()->CallJavascriptFunctionUnsafe(
72 "chrome.SnippetsInternals.receiveJson", 72 "chrome.SnippetsInternals.receiveJson",
73 base::StringValue( 73 base::StringValue(
74 ntp_snippets_service_->snippets_fetcher()->last_json())); 74 ntp_snippets_service_->snippets_fetcher()->last_json()));
75 } 75 }
76 76
77 void SnippetsInternalsMessageHandler::NTPSnippetsServiceDisabled() {} 77 void SnippetsInternalsMessageHandler::NTPSnippetsServiceDisabledReasonChanged(
78 ntp_snippets::DisabledReason disabled_reason) {}
78 79
79 void SnippetsInternalsMessageHandler::RegisterMessages() { 80 void SnippetsInternalsMessageHandler::RegisterMessages() {
80 // additional initialization (web_ui() does not work from the constructor) 81 // additional initialization (web_ui() does not work from the constructor)
81 ntp_snippets_service_ = NTPSnippetsServiceFactory::GetInstance()-> 82 ntp_snippets_service_ = NTPSnippetsServiceFactory::GetInstance()->
82 GetForProfile(Profile::FromWebUI(web_ui())); 83 GetForProfile(Profile::FromWebUI(web_ui()));
83 observer_.Add(ntp_snippets_service_); 84 observer_.Add(ntp_snippets_service_);
84 85
85 web_ui()->RegisterMessageCallback( 86 web_ui()->RegisterMessageCallback(
86 "loaded", 87 "loaded",
87 base::Bind(&SnippetsInternalsMessageHandler::HandleLoaded, 88 base::Bind(&SnippetsInternalsMessageHandler::HandleLoaded,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } 225 }
225 226
226 void SnippetsInternalsMessageHandler::SendString(const std::string& name, 227 void SnippetsInternalsMessageHandler::SendString(const std::string& name,
227 const std::string& value) { 228 const std::string& value) {
228 base::StringValue string_name(name); 229 base::StringValue string_name(name);
229 base::StringValue string_value(value); 230 base::StringValue string_value(value);
230 231
231 web_ui()->CallJavascriptFunctionUnsafe( 232 web_ui()->CallJavascriptFunctionUnsafe(
232 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); 233 "chrome.SnippetsInternals.receiveProperty", string_name, string_value);
233 } 234 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/snippets_internals_message_handler.h ('k') | components/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698