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

Side by Side Diff: chrome/browser/sync/js/js_sync_manager_observer.cc

Issue 7861013: Fix the false-positive detection of commit errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another attempt at detecting errors Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/sync/js/js_sync_manager_observer.h" 5 #include "chrome/browser/sync/js/js_sync_manager_observer.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/sync/internal_api/change_record.h" 13 #include "chrome/browser/sync/internal_api/change_record.h"
14 #include "chrome/browser/sync/js/js_arg_list.h" 14 #include "chrome/browser/sync/js/js_arg_list.h"
15 #include "chrome/browser/sync/js/js_event_details.h" 15 #include "chrome/browser/sync/js/js_event_details.h"
16 #include "chrome/browser/sync/js/js_event_handler.h" 16 #include "chrome/browser/sync/js/js_event_handler.h"
17 #include "chrome/browser/sync/sessions/session_state.h" 17 #include "chrome/browser/sync/sessions/session_state.h"
18 #include "chrome/browser/sync/syncable/model_type.h" 18 #include "chrome/browser/sync/syncable/model_type.h"
19 19
20 namespace browser_sync { 20 namespace browser_sync {
21 21
22 using browser_sync::SyncProtocolError; 22 using browser_sync::SyncOperationResult;
23 23
24 JsSyncManagerObserver::JsSyncManagerObserver() {} 24 JsSyncManagerObserver::JsSyncManagerObserver() {}
25 25
26 JsSyncManagerObserver::~JsSyncManagerObserver() {} 26 JsSyncManagerObserver::~JsSyncManagerObserver() {}
27 27
28 void JsSyncManagerObserver::SetJsEventHandler( 28 void JsSyncManagerObserver::SetJsEventHandler(
29 const WeakHandle<JsEventHandler>& event_handler) { 29 const WeakHandle<JsEventHandler>& event_handler) {
30 event_handler_ = event_handler; 30 event_handler_ = event_handler;
31 } 31 }
32 32
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (!event_handler_.IsInitialized()) { 85 if (!event_handler_.IsInitialized()) {
86 return; 86 return;
87 } 87 }
88 DictionaryValue details; 88 DictionaryValue details;
89 details.Set("encryptedTypes", 89 details.Set("encryptedTypes",
90 syncable::ModelTypeSetToValue(encrypted_types)); 90 syncable::ModelTypeSetToValue(encrypted_types));
91 HandleJsEvent(FROM_HERE, "onEncryptionComplete", JsEventDetails(&details)); 91 HandleJsEvent(FROM_HERE, "onEncryptionComplete", JsEventDetails(&details));
92 } 92 }
93 93
94 void JsSyncManagerObserver::OnActionableError( 94 void JsSyncManagerObserver::OnActionableError(
95 const SyncProtocolError& sync_error) { 95 const SyncOperationResult& sync_error) {
96 if (!event_handler_.IsInitialized()) { 96 if (!event_handler_.IsInitialized()) {
97 return; 97 return;
98 } 98 }
99 DictionaryValue details; 99 DictionaryValue details;
100 details.Set("syncError", sync_error.ToValue()); 100 details.Set("syncError", sync_error.ToValue());
101 HandleJsEvent(FROM_HERE, "onActionableError", 101 HandleJsEvent(FROM_HERE, "onActionableError",
102 JsEventDetails(&details)); 102 JsEventDetails(&details));
103 } 103 }
104 104
105 void JsSyncManagerObserver::OnInitializationComplete( 105 void JsSyncManagerObserver::OnInitializationComplete(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 const std::string& name, const JsEventDetails& details) { 139 const std::string& name, const JsEventDetails& details) {
140 if (!event_handler_.IsInitialized()) { 140 if (!event_handler_.IsInitialized()) {
141 NOTREACHED(); 141 NOTREACHED();
142 return; 142 return;
143 } 143 }
144 event_handler_.Call(from_here, 144 event_handler_.Call(from_here,
145 &JsEventHandler::HandleJsEvent, name, details); 145 &JsEventHandler::HandleJsEvent, name, details);
146 } 146 }
147 147
148 } // namespace browser_sync 148 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/js/js_sync_manager_observer.h ('k') | chrome/browser/sync/js/js_sync_manager_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698