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 "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/search/search.h" | 9 #include "chrome/browser/search/search.h" |
9 #include "chrome/browser/ui/search/instant_ipc_sender.h" | 10 #include "chrome/browser/ui/search/instant_ipc_sender.h" |
10 #include "chrome/browser/ui/search/search_model.h" | 11 #include "chrome/browser/ui/search/search_model.h" |
11 #include "chrome/browser/ui/search/search_tab_helper.h" | 12 #include "chrome/browser/ui/search/search_tab_helper.h" |
12 #include "chrome/common/render_messages.h" | 13 #include "chrome/common/render_messages.h" |
13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
14 #include "content/public/browser/navigation_controller.h" | 15 #include "content/public/browser/navigation_controller.h" |
15 #include "content/public/browser/navigation_details.h" | 16 #include "content/public/browser/navigation_details.h" |
16 #include "content/public/browser/navigation_entry.h" | 17 #include "content/public/browser/navigation_entry.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 ui::ResourceBundle::MediumFont).DeriveFont(1); | 51 ui::ResourceBundle::MediumFont).DeriveFont(1); |
51 #else | 52 #else |
52 const gfx::Font& omnibox_font = | 53 const gfx::Font& omnibox_font = |
53 ui::ResourceBundle::GetSharedInstance().GetFont( | 54 ui::ResourceBundle::GetSharedInstance().GetFont( |
54 ui::ResourceBundle::MediumFont); | 55 ui::ResourceBundle::MediumFont); |
55 #endif | 56 #endif |
56 sender()->SetFontInformation(UTF8ToUTF16(omnibox_font.GetFontName()), | 57 sender()->SetFontInformation(UTF8ToUTF16(omnibox_font.GetFontName()), |
57 omnibox_font.GetFontSize()); | 58 omnibox_font.GetFontSize()); |
58 } | 59 } |
59 | 60 |
| 61 void InstantPage::InitializePromos() { |
| 62 sender()->SetPromoInformation(apps::IsAppLauncherEnabled()); |
| 63 } |
| 64 |
60 InstantPage::InstantPage(Delegate* delegate, const std::string& instant_url, | 65 InstantPage::InstantPage(Delegate* delegate, const std::string& instant_url, |
61 bool is_incognito) | 66 bool is_incognito) |
62 : delegate_(delegate), | 67 : delegate_(delegate), |
63 ipc_sender_(InstantIPCSender::Create(is_incognito)), | 68 ipc_sender_(InstantIPCSender::Create(is_incognito)), |
64 instant_url_(instant_url), | 69 instant_url_(instant_url), |
65 is_incognito_(is_incognito) { | 70 is_incognito_(is_incognito) { |
66 } | 71 } |
67 | 72 |
68 void InstantPage::SetContents(content::WebContents* web_contents) { | 73 void InstantPage::SetContents(content::WebContents* web_contents) { |
69 ClearContents(); | 74 ClearContents(); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 delegate_->UndoAllMostVisitedDeletions(); | 291 delegate_->UndoAllMostVisitedDeletions(); |
287 } | 292 } |
288 | 293 |
289 void InstantPage::ClearContents() { | 294 void InstantPage::ClearContents() { |
290 if (contents()) | 295 if (contents()) |
291 SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this); | 296 SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this); |
292 | 297 |
293 sender()->SetContents(NULL); | 298 sender()->SetContents(NULL); |
294 Observe(NULL); | 299 Observe(NULL); |
295 } | 300 } |
OLD | NEW |