| 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 "blimp/client/core/feedback/blimp_feedback_data.h" | 5 #include "blimp/client/core/feedback/blimp_feedback_data.h" |
| 6 | 6 |
| 7 #include "blimp/client/core/contents/blimp_contents_manager.h" | 7 #include "blimp/client/core/contents/blimp_contents_manager.h" |
| 8 | 8 |
| 9 namespace blimp { | 9 namespace blimp { |
| 10 namespace client { | 10 namespace client { |
| 11 const char kFeedbackSupportedKey[] = "Blimp Supported"; | 11 const char kFeedbackSupportedKey[] = "Blimp Supported"; |
| 12 const char kFeedbackHasVisibleBlimpContents[] = "Blimp Visible"; | 12 const char kFeedbackHasVisibleBlimpContents[] = "Blimp Visible"; |
| 13 const char kFeedbackUserNameKey[] = "Blimp Account"; |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 std::string HasVisibleBlimpContents( | 16 std::string HasVisibleBlimpContents( |
| 16 BlimpContentsManager* blimp_contents_manager) { | 17 BlimpContentsManager* blimp_contents_manager) { |
| 17 std::vector<BlimpContentsImpl*> all_blimp_contents = | 18 std::vector<BlimpContentsImpl*> all_blimp_contents = |
| 18 blimp_contents_manager->GetAllActiveBlimpContents(); | 19 blimp_contents_manager->GetAllActiveBlimpContents(); |
| 19 for (const auto& item : all_blimp_contents) { | 20 for (const auto& item : all_blimp_contents) { |
| 20 if (item->document_manager()->visible()) { | 21 if (item->document_manager()->visible()) { |
| 21 return "true"; | 22 return "true"; |
| 22 } | 23 } |
| 23 } | 24 } |
| 24 return "false"; | 25 return "false"; |
| 25 } | 26 } |
| 26 } // namespace | 27 } // namespace |
| 27 | 28 |
| 28 std::unordered_map<std::string, std::string> CreateBlimpFeedbackData( | 29 std::unordered_map<std::string, std::string> CreateBlimpFeedbackData( |
| 29 BlimpContentsManager* blimp_contents_manager) { | 30 BlimpContentsManager* blimp_contents_manager, |
| 31 const std::string& username) { |
| 30 std::unordered_map<std::string, std::string> data; | 32 std::unordered_map<std::string, std::string> data; |
| 31 data.insert(std::make_pair(kFeedbackSupportedKey, "true")); | 33 data.insert(std::make_pair(kFeedbackSupportedKey, "true")); |
| 32 data.insert(std::make_pair(kFeedbackHasVisibleBlimpContents, | 34 data.insert(std::make_pair(kFeedbackHasVisibleBlimpContents, |
| 33 HasVisibleBlimpContents(blimp_contents_manager))); | 35 HasVisibleBlimpContents(blimp_contents_manager))); |
| 36 data.insert(std::make_pair(kFeedbackUserNameKey, username)); |
| 34 return data; | 37 return data; |
| 35 } | 38 } |
| 36 | 39 |
| 37 } // namespace client | 40 } // namespace client |
| 38 } // namespace blimp | 41 } // namespace blimp |
| OLD | NEW |