Chromium Code Reviews| 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 "apps/app_launcher.h" | 7 #include "apps/app_launcher.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/search/search.h" | 9 #include "chrome/browser/search/search.h" |
| 10 #include "chrome/browser/ui/search/instant_ntp.h" | 10 #include "chrome/browser/ui/search/instant_ntp.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 bool InstantPage::supports_instant() const { | 31 bool InstantPage::supports_instant() const { |
| 32 return contents() ? | 32 return contents() ? |
| 33 SearchTabHelper::FromWebContents(contents())->SupportsInstant() : false; | 33 SearchTabHelper::FromWebContents(contents())->SupportsInstant() : false; |
| 34 } | 34 } |
| 35 | 35 |
| 36 const std::string& InstantPage::instant_url() const { | 36 const std::string& InstantPage::instant_url() const { |
| 37 return instant_url_; | 37 return instant_url_; |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool InstantPage::IsLocal() const { | 40 bool InstantPage::IsLocal() const { |
| 41 return contents() && | 41 return contents() && |
|
samarth
2013/07/12 17:16:06
nit: fits on one line?
kmadhusu
2013/07/15 22:21:51
It doesn't fit in the previous line.
| |
| 42 (contents()->GetURL() == GURL(chrome::kChromeSearchLocalNtpUrl) || | 42 contents()->GetURL() == GURL(chrome::kChromeSearchLocalNtpUrl); |
| 43 contents()->GetURL() == GURL(chrome::kChromeSearchLocalGoogleNtpUrl)); | |
| 44 } | 43 } |
| 45 | 44 |
| 46 void InstantPage::InitializeFonts() { | 45 void InstantPage::InitializeFonts() { |
| 47 #if defined(OS_MACOSX) | 46 #if defined(OS_MACOSX) |
| 48 // This value should be kept in sync with OmniboxViewMac::GetFieldFont. | 47 // This value should be kept in sync with OmniboxViewMac::GetFieldFont. |
| 49 const gfx::Font& omnibox_font = | 48 const gfx::Font& omnibox_font = |
| 50 ui::ResourceBundle::GetSharedInstance().GetFont( | 49 ui::ResourceBundle::GetSharedInstance().GetFont( |
| 51 ui::ResourceBundle::MediumFont).DeriveFont(1); | 50 ui::ResourceBundle::MediumFont).DeriveFont(1); |
| 52 #else | 51 #else |
| 53 const gfx::Font& omnibox_font = | 52 const gfx::Font& omnibox_font = |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 delegate_->UndoAllMostVisitedDeletions(); | 242 delegate_->UndoAllMostVisitedDeletions(); |
| 244 } | 243 } |
| 245 | 244 |
| 246 void InstantPage::ClearContents() { | 245 void InstantPage::ClearContents() { |
| 247 if (contents()) | 246 if (contents()) |
| 248 SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this); | 247 SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this); |
| 249 | 248 |
| 250 sender()->SetContents(NULL); | 249 sender()->SetContents(NULL); |
| 251 Observe(NULL); | 250 Observe(NULL); |
| 252 } | 251 } |
| OLD | NEW |