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

Side by Side Diff: chrome/common/instant_types.cc

Issue 16413002: Moved theme related state from BrowserInstantController to InstantService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 years, 6 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/common/instant_types.h" 5 #include "chrome/common/instant_types.h"
6 6
7 InstantSuggestion::InstantSuggestion() 7 InstantSuggestion::InstantSuggestion()
8 : behavior(INSTANT_COMPLETE_NOW), 8 : behavior(INSTANT_COMPLETE_NOW),
9 type(INSTANT_SUGGESTION_SEARCH), 9 type(INSTANT_SUGGESTION_SEARCH),
10 autocomplete_match_index(kNoMatchIndex) { 10 autocomplete_match_index(kNoMatchIndex) {
(...skipping 16 matching lines...) Expand all
27 27
28 InstantAutocompleteResult::InstantAutocompleteResult() 28 InstantAutocompleteResult::InstantAutocompleteResult()
29 : transition(content::PAGE_TRANSITION_LINK), 29 : transition(content::PAGE_TRANSITION_LINK),
30 relevance(0) { 30 relevance(0) {
31 } 31 }
32 32
33 InstantAutocompleteResult::~InstantAutocompleteResult() { 33 InstantAutocompleteResult::~InstantAutocompleteResult() {
34 } 34 }
35 35
36 ThemeBackgroundInfo::ThemeBackgroundInfo() 36 ThemeBackgroundInfo::ThemeBackgroundInfo()
37 : color_r(0), 37 : color_r(-1),
38 color_g(0), 38 color_g(-1),
39 color_b(0), 39 color_b(-1),
40 color_a(0), 40 color_a(-1),
41 image_horizontal_alignment(THEME_BKGRND_IMAGE_ALIGN_CENTER), 41 image_horizontal_alignment(THEME_BKGRND_INVALID_ALIGNMENT),
42 image_vertical_alignment(THEME_BKGRND_IMAGE_ALIGN_CENTER), 42 image_vertical_alignment(THEME_BKGRND_INVALID_ALIGNMENT),
43 image_tiling(THEME_BKGRND_IMAGE_NO_REPEAT), 43 image_tiling(THEME_BKGRND_INVALID_REPEAT),
44 image_height(0), 44 image_height(0),
45 has_attribution(false) { 45 has_attribution(false) {
46 } 46 }
47 47
48 ThemeBackgroundInfo::~ThemeBackgroundInfo() { 48 ThemeBackgroundInfo::~ThemeBackgroundInfo() {
49 } 49 }
50
51 void ThemeBackgroundInfo::Initialize() {
samarth 2013/06/19 00:14:36 I don't like having a Initialize method on a struc
kmadhusu 2013/06/19 02:27:24 SearchTabHelper tracks |last_known_theme_info_|. W
52 color_r = 0;
53 color_g = 0;
54 color_b = 0;
55 color_a = 0;
56 theme_id = std::string();
57 image_horizontal_alignment = THEME_BKGRND_IMAGE_ALIGN_CENTER;
58 image_vertical_alignment = THEME_BKGRND_IMAGE_ALIGN_CENTER;
59 image_tiling = THEME_BKGRND_IMAGE_NO_REPEAT;
60 image_height = 0;
61 has_attribution = false;
62 }
63
64 bool ThemeBackgroundInfo::IsValid() const {
65 bool valid_image_details =
66 image_horizontal_alignment != THEME_BKGRND_INVALID_ALIGNMENT &&
67 image_vertical_alignment != THEME_BKGRND_INVALID_ALIGNMENT &&
68 image_tiling != THEME_BKGRND_INVALID_REPEAT &&
69 image_height > 0;
70
71 return color_r >= 0 && color_r <= 255 &&
72 color_g >= 0 && color_r <= 255 &&
73 color_b >= 0 && color_b <= 255 &&
74 color_a >= 0 && color_a <= 255 &&
75 (theme_id.empty() ^ valid_image_details);
76 }
77
78 bool ThemeBackgroundInfo::operator==(const ThemeBackgroundInfo& rhs) const {
79 return color_r == rhs.color_r &&
80 color_g == rhs.color_g &&
81 color_b == rhs.color_b &&
82 color_a == rhs.color_a &&
83 theme_id == rhs.theme_id &&
84 image_horizontal_alignment == rhs.image_horizontal_alignment &&
85 image_vertical_alignment == rhs.image_vertical_alignment &&
86 image_tiling == rhs.image_tiling &&
87 image_height == rhs.image_height &&
88 has_attribution == rhs.has_attribution;
89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698