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

Side by Side Diff: chrome/browser/android/contextualsearch/contextual_search_delegate.cc

Issue 2542813002: [TTS] Log diagnostic output log for Contextual Cards. (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/android/contextualsearch/contextual_search_delegate.h" 5 #include "chrome/browser/android/contextualsearch/contextual_search_delegate.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 } else if (quick_action_category_string == kActionCategoryPhone) { 551 } else if (quick_action_category_string == kActionCategoryPhone) {
552 *quick_action_category = QUICK_ACTION_CATEGORY_PHONE; 552 *quick_action_category = QUICK_ACTION_CATEGORY_PHONE;
553 } 553 }
554 } 554 }
555 } 555 }
556 556
557 if (field_trial_->IsContextualCardsBarIntegrationEnabled() || 557 if (field_trial_->IsContextualCardsBarIntegrationEnabled() ||
558 base::FeatureList::IsEnabled( 558 base::FeatureList::IsEnabled(
559 chrome::android::kContextualSearchSingleActions)) { 559 chrome::android::kContextualSearchSingleActions)) {
560 // Any Contextual Cards integration. 560 // Any Contextual Cards integration.
561 // For testing purposes check if there was a Contextual Cards backend 561 // For testing purposes check if there was a diagnostic from Contextual
562 // failure and flag that in the log. 562 // Cards and output that into the log.
563 // TODO(donnd): remove after full Contextual Cards integration. 563 // TODO(donnd): remove after full Contextual Cards integration.
564 bool contextual_cards_backend_responded = true; 564 std::string contextual_cards_diagnostic;
565 dict->GetBoolean("coca_responded", &contextual_cards_backend_responded); 565 dict->GetString("diagnostic", &contextual_cards_diagnostic);
566 if (!contextual_cards_backend_responded) { 566 if (contextual_cards_diagnostic.empty()) {
567 DVLOG(0) << ""; 567 DVLOG(0) << "No diagnostic data in the response.";
568 DVLOG(0) << "!!! CONTEXTUAL SEARCH WARNING !!!"; 568 } else {
569 DVLOG(0) 569 DVLOG(0) << "The Contextual Cards backend response: ";
570 << "The Contextual Cards backend did not respond to this " 570 DVLOG(0) << contextual_cards_diagnostic;
571 "request!!! The backend server may not be configured or is down.";
572 DVLOG(0) << "";
573 } 571 }
574 } 572 }
575 } 573 }
576 574
577 // Extract the Start/End of the mentions in the surrounding text 575 // Extract the Start/End of the mentions in the surrounding text
578 // for selection-expansion. 576 // for selection-expansion.
579 void ContextualSearchDelegate::ExtractMentionsStartEnd( 577 void ContextualSearchDelegate::ExtractMentionsStartEnd(
580 const base::ListValue& mentions_list, 578 const base::ListValue& mentions_list,
581 int* startResult, 579 int* startResult,
582 int* endResult) { 580 int* endResult) {
(...skipping 24 matching lines...) Expand all
607 end_offset -= trim; 605 end_offset -= trim;
608 } 606 }
609 if (result_text.length() > end_offset + padding_each_side_pinned) { 607 if (result_text.length() > end_offset + padding_each_side_pinned) {
610 // Trim the end. 608 // Trim the end.
611 result_text = result_text.substr(0, end_offset + padding_each_side_pinned); 609 result_text = result_text.substr(0, end_offset + padding_each_side_pinned);
612 } 610 }
613 *start = start_offset; 611 *start = start_offset;
614 *end = end_offset; 612 *end = end_offset;
615 return result_text; 613 return result_text;
616 } 614 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698