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