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_AURA) |
| 63 #include "ash/shell.h" |
| 64 #endif |
| 65 |
62 using content::BrowserThread; | 66 using content::BrowserThread; |
63 using content::UserMetricsAction; | 67 using content::UserMetricsAction; |
64 using content::WebContents; | 68 using content::WebContents; |
65 using content::WebUIController; | 69 using content::WebUIController; |
66 | 70 |
67 namespace { | 71 namespace { |
68 | 72 |
69 // The amount of time there must be no painting for us to consider painting | 73 // The amount of time there must be no painting for us to consider painting |
70 // finished. Observed times are in the ~1200ms range on Windows. | 74 // finished. Observed times are in the ~1200ms range on Windows. |
71 const int kTimeoutMs = 2000; | 75 const int kTimeoutMs = 2000; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // static | 290 // static |
287 bool NewTabUI::ShouldShowAppInstallHint() { | 291 bool NewTabUI::ShouldShowAppInstallHint() { |
288 const CommandLine* cli = CommandLine::ForCurrentProcess(); | 292 const CommandLine* cli = CommandLine::ForCurrentProcess(); |
289 return cli->HasSwitch(switches::kNtpAppInstallHint) || | 293 return cli->HasSwitch(switches::kNtpAppInstallHint) || |
290 WebStoreLinkExperimentGroupIs(g_hint_group); | 294 WebStoreLinkExperimentGroupIs(g_hint_group); |
291 } | 295 } |
292 | 296 |
293 // static | 297 // static |
294 bool NewTabUI::ShouldShowAppsPage() { | 298 bool NewTabUI::ShouldShowAppsPage() { |
295 #if defined(USE_AURA) | 299 #if defined(USE_AURA) |
296 // Ash shows apps in app list thus should not show apps page in NTP4. | 300 // Ash shows apps in app list thus should not show apps page in NTP4 unless |
297 return false; | 301 // it is running in compact mode (crbug.com/116852). |
| 302 return ash::Shell::GetInstance()->IsWindowModeCompact(); |
298 #else | 303 #else |
299 return true; | 304 return true; |
300 #endif | 305 #endif |
301 } | 306 } |
302 | 307 |
303 // static | 308 // static |
304 bool NewTabUI::IsSuggestionsPageEnabled() { | 309 bool NewTabUI::IsSuggestionsPageEnabled() { |
305 return CommandLine::ForCurrentProcess()->HasSwitch( | 310 return CommandLine::ForCurrentProcess()->HasSwitch( |
306 switches::kEnableSuggestionsTabPage); | 311 switches::kEnableSuggestionsTabPage); |
307 } | 312 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 } | 411 } |
407 | 412 |
408 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, | 413 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, |
409 const char* mime_type, | 414 const char* mime_type, |
410 int resource_id) { | 415 int resource_id) { |
411 DCHECK(resource); | 416 DCHECK(resource); |
412 DCHECK(mime_type); | 417 DCHECK(mime_type); |
413 resource_map_[std::string(resource)] = | 418 resource_map_[std::string(resource)] = |
414 std::make_pair(std::string(mime_type), resource_id); | 419 std::make_pair(std::string(mime_type), resource_id); |
415 } | 420 } |
OLD | NEW |