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