1 /*
2  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3  * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
4  * All rights reserved.
5  * Copyright (C) 2013 Google Inc. All rights reserved.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  *
22  */
23 
24 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_MEDIA_QUERY_RESULT_H_
25 #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_MEDIA_QUERY_RESULT_H_
26 
27 #include "third_party/blink/renderer/core/css/media_query_exp.h"
28 
29 namespace blink {
30 
31 class CORE_EXPORT MediaQueryResult {
32   DISALLOW_NEW();
33 
34  public:
MediaQueryResult(const MediaQueryExp & expr,bool result)35   MediaQueryResult(const MediaQueryExp& expr, bool result)
36       : expression_(expr), result_(result) {}
37 
38   bool operator==(const MediaQueryResult& other) const {
39     return expression_ == other.expression_ && result_ == other.result_;
40   }
41   bool operator!=(const MediaQueryResult& other) const {
42     return !(*this == other);
43   }
44 
Expression()45   const MediaQueryExp& Expression() const { return expression_; }
46 
Result()47   bool Result() const { return result_; }
48 
49  private:
50   const MediaQueryExp expression_;
51   bool result_;
52 };
53 
54 class MediaQuerySetResult {
55   DISALLOW_NEW();
56 
57  public:
MediaQuerySetResult(const MediaQuerySet & media_queries,bool result)58   MediaQuerySetResult(const MediaQuerySet& media_queries, bool result)
59       : media_queries_(&media_queries), result_(result) {}
60 
MediaQueries()61   const MediaQuerySet& MediaQueries() const { return *media_queries_; }
62 
Result()63   bool Result() const { return result_; }
64 
65  private:
66   scoped_refptr<const MediaQuerySet> media_queries_;
67   bool result_;
68 };
69 
70 }  // namespace blink
71 
72 #endif
73