OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "content/public/browser/web_ui.h" | 52 #include "content/public/browser/web_ui.h" |
53 #include "grit/browser_resources.h" | 53 #include "grit/browser_resources.h" |
54 #include "grit/generated_resources.h" | 54 #include "grit/generated_resources.h" |
55 #include "grit/theme_resources.h" | 55 #include "grit/theme_resources.h" |
56 #include "ui/base/l10n/l10n_util.h" | 56 #include "ui/base/l10n/l10n_util.h" |
57 | 57 |
58 #if !defined(OS_ANDROID) | 58 #if !defined(OS_ANDROID) |
59 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h" | 59 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h" |
60 #endif | 60 #endif |
61 | 61 |
62 #if defined(USE_ASH) | |
63 #include "ash/shell.h" | |
64 #endif | |
65 | |
66 using content::BrowserThread; | 62 using content::BrowserThread; |
67 using content::RenderViewHost; | 63 using content::RenderViewHost; |
68 using content::UserMetricsAction; | 64 using content::UserMetricsAction; |
69 using content::WebContents; | 65 using content::WebContents; |
70 using content::WebUIController; | 66 using content::WebUIController; |
71 | 67 |
72 namespace { | 68 namespace { |
73 | 69 |
74 // The amount of time there must be no painting for us to consider painting | 70 // The amount of time there must be no painting for us to consider painting |
75 // finished. Observed times are in the ~1200ms range on Windows. | 71 // finished. Observed times are in the ~1200ms range on Windows. |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // static | 287 // static |
292 bool NewTabUI::ShouldShowAppInstallHint() { | 288 bool NewTabUI::ShouldShowAppInstallHint() { |
293 const CommandLine* cli = CommandLine::ForCurrentProcess(); | 289 const CommandLine* cli = CommandLine::ForCurrentProcess(); |
294 return cli->HasSwitch(switches::kNtpAppInstallHint) || | 290 return cli->HasSwitch(switches::kNtpAppInstallHint) || |
295 WebStoreLinkExperimentGroupIs(g_hint_group); | 291 WebStoreLinkExperimentGroupIs(g_hint_group); |
296 } | 292 } |
297 | 293 |
298 // static | 294 // static |
299 bool NewTabUI::ShouldShowAppsPage() { | 295 bool NewTabUI::ShouldShowAppsPage() { |
300 #if defined(USE_ASH) | 296 #if defined(USE_ASH) |
301 // Ash shows apps in app list thus should not show apps page in NTP4 unless | 297 // Ash shows apps in app list thus should not show apps page in NTP4. |
302 // it is running in compact mode (crbug.com/116852). | |
303 if (ash::Shell::HasInstance()) | |
304 return ash::Shell::GetInstance()->IsWindowModeCompact(); | |
305 return false; | 298 return false; |
306 #else | 299 #else |
307 return true; | 300 return true; |
308 #endif | 301 #endif |
309 } | 302 } |
310 | 303 |
311 // static | 304 // static |
312 bool NewTabUI::IsSuggestionsPageEnabled() { | 305 bool NewTabUI::IsSuggestionsPageEnabled() { |
313 return CommandLine::ForCurrentProcess()->HasSwitch( | 306 return CommandLine::ForCurrentProcess()->HasSwitch( |
314 switches::kEnableSuggestionsTabPage); | 307 switches::kEnableSuggestionsTabPage); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 } | 407 } |
415 | 408 |
416 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, | 409 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, |
417 const char* mime_type, | 410 const char* mime_type, |
418 int resource_id) { | 411 int resource_id) { |
419 DCHECK(resource); | 412 DCHECK(resource); |
420 DCHECK(mime_type); | 413 DCHECK(mime_type); |
421 resource_map_[std::string(resource)] = | 414 resource_map_[std::string(resource)] = |
422 std::make_pair(std::string(mime_type), resource_id); | 415 std::make_pair(std::string(mime_type), resource_id); |
423 } | 416 } |
OLD | NEW |