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

Side by Side Diff: ios/chrome/browser/ui/contextual_search/contextual_search_context.h

Issue 2588713002: Upstream Chrome on iOS source code [4/11]. (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
OLDNEW
(Empty)
1 // Copyright 2014 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 #ifndef IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_CONTEXT_H_
6 #define IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_CONTEXT_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "url/gurl.h"
12
13 // Encapsulates key parts of a Contextual Search Context, including surrounding
14 // text.
15 struct ContextualSearchContext {
16 ContextualSearchContext(const std::string& selected_text,
17 const bool use_resolved_search_term,
18 const GURL& page_url,
19 const std::string& encoding);
20 ~ContextualSearchContext();
21
22 // Text that was tapped on.
23 const std::string selected_text;
24 // If the resolved term (rather than the selected text) should be used.
25 const bool use_resolved_search_term;
26 // URL of the page that was tapped in.
27 const GURL page_url;
28 // Encoding of the page.
29 const std::string encoding;
30
31 // Text surrounding the tapped text.
32 base::string16 surrounding_text;
33 // Starting offset of |selected_text| within |surrounding_text|.
34 int start_offset;
35 // End offset of |selected_text| within |surrounding_text|.
36 int end_offset;
37
38 // Returns whether the selection needs context resolution. If no,
39 // |selected_text| is the correct query, both for searching and displaying and
40 // |surrounding_text|, |start_offset|, |end_offset| are irrelevant.
41 bool HasSurroundingText();
42
43 DISALLOW_COPY_AND_ASSIGN(ContextualSearchContext);
44 };
45
46 #endif // IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698