OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/search/instant_page.h" | 5 #include "chrome/browser/ui/search/instant_page.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/search/search.h" | 8 #include "chrome/browser/search/search.h" |
9 #include "chrome/browser/ui/search/search_model.h" | 9 #include "chrome/browser/ui/search/search_model.h" |
10 #include "chrome/browser/ui/search/search_tab_helper.h" | 10 #include "chrome/browser/ui/search/search_tab_helper.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 const std::string& InstantPage::instant_url() const { | 37 const std::string& InstantPage::instant_url() const { |
38 return instant_url_; | 38 return instant_url_; |
39 } | 39 } |
40 | 40 |
41 bool InstantPage::IsLocal() const { | 41 bool InstantPage::IsLocal() const { |
42 return web_contents() && | 42 return web_contents() && |
43 web_contents()->GetURL() == GURL(chrome::kChromeSearchLocalNtpUrl); | 43 web_contents()->GetURL() == GURL(chrome::kChromeSearchLocalNtpUrl); |
44 } | 44 } |
45 | 45 |
46 InstantPage::InstantPage(Delegate* delegate, const std::string& instant_url, | 46 InstantPage::InstantPage(Delegate* delegate, |
47 Profile* profile, bool is_incognito) | 47 const std::string& instant_url, |
| 48 Profile* profile) |
48 : profile_(profile), | 49 : profile_(profile), |
49 delegate_(delegate), | 50 delegate_(delegate), |
50 instant_url_(instant_url), | 51 instant_url_(instant_url) { |
51 is_incognito_(is_incognito) { | |
52 } | 52 } |
53 | 53 |
54 void InstantPage::SetContents(content::WebContents* new_web_contents) { | 54 void InstantPage::SetContents(content::WebContents* new_web_contents) { |
55 ClearContents(); | 55 ClearContents(); |
56 | 56 |
57 if (!new_web_contents) | 57 if (!new_web_contents) |
58 return; | 58 return; |
59 | 59 |
60 Observe(new_web_contents); | 60 Observe(new_web_contents); |
61 SearchModel* model = | 61 SearchModel* model = |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 95 } |
96 | 96 |
97 void InstantPage::ClearContents() { | 97 void InstantPage::ClearContents() { |
98 if (web_contents()) { | 98 if (web_contents()) { |
99 SearchTabHelper::FromWebContents(web_contents())->model()->RemoveObserver( | 99 SearchTabHelper::FromWebContents(web_contents())->model()->RemoveObserver( |
100 this); | 100 this); |
101 } | 101 } |
102 | 102 |
103 Observe(NULL); | 103 Observe(NULL); |
104 } | 104 } |
OLD | NEW |