diff options
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 9 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.h | 6 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 22 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rw-r--r-- | chrome/test/startup/feature_startup_test.cc | 5 |
5 files changed, 33 insertions, 10 deletions
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index deb9683..5ccd3fe 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -1498,6 +1498,9 @@ NewTabUI::NewTabUI(TabContents* contents) NewTabHTMLSource::set_first_view(false); } + if (NewTabUI::FirstRunDisabled()) + NewTabHTMLSource::set_first_run(false); + tab_contents()->render_view_host()->set_paint_observer(new PaintTimer); if (GetProfile()->IsOffTheRecord()) { @@ -1599,3 +1602,9 @@ bool NewTabUI::WebResourcesEnabled() { const CommandLine* command_line = CommandLine::ForCurrentProcess(); return command_line->HasSwitch(switches::kEnableWebResources); } + +// static +bool NewTabUI::FirstRunDisabled() { + const CommandLine* command_line = CommandLine::ForCurrentProcess(); + return command_line->HasSwitch(switches::kDisableNewTabFirstRun); +} diff --git a/chrome/browser/dom_ui/new_tab_ui.h b/chrome/browser/dom_ui/new_tab_ui.h index fde0fe2..07f27ca 100644 --- a/chrome/browser/dom_ui/new_tab_ui.h +++ b/chrome/browser/dom_ui/new_tab_ui.h @@ -31,7 +31,11 @@ class NewTabUI : public DOMUI, // Whether we should disable the web resources backend service static bool WebResourcesEnabled(); - private: + // Whether we should disable the first run notification based on the command + // line switch. + static bool FirstRunDisabled(); + +private: void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index a8f208e..e0a35a6 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -477,45 +477,49 @@ const wchar_t kSimpleDataSource[] = L"simple-data-source"; // persistent representation generated by field_trial.cc and later decoded, is a // list of name and value pairs, separated by slashes. See field trial.cc for // current details. -const wchar_t kForceFieldTestNameAndValue[] = L"force-fieldtest"; +const wchar_t kForceFieldTestNameAndValue[] = L"force-fieldtest"; // Allows the new tab page resource to be loaded from a local HTML file. This // should be a path to the HTML file that you want to use for the new tab page. -const wchar_t kNewTabPage[] = L"new-tab-page"; +const wchar_t kNewTabPage[] = L"new-tab-page"; // Switches back to the old new tab page. -const wchar_t kOldNewTabPage[] = L"old-new-tab-page"; +const wchar_t kOldNewTabPage[] = L"old-new-tab-page"; // Enables the backend service for web resources, used in the new tab page for // loading tips and recommendations from a JSON feed. -const wchar_t kEnableWebResources[] = L"enable-web-resources"; +const wchar_t kEnableWebResources[] = L"enable-web-resources"; + +// Whether we should prevent the new tab page from showing the first run +// notification. +const wchar_t kDisableNewTabFirstRun[] = L"disable-new-tab-first-run"; // Disables the default browser check. Useful for UI/browser tests where we want // to avoid having the default browser info-bar displayed. -const wchar_t kNoDefaultBrowserCheck[] = L"no-default-browser-check"; +const wchar_t kNoDefaultBrowserCheck[] = L"no-default-browser-check"; // Enables the Privacy Blacklist with the specified data file. // The file contains data from all imported blacklists. const wchar_t kPrivacyBlacklist[] = L"privacy-blacklist"; // Enables the benchmarking extensions. -const wchar_t kEnableBenchmarking[] = L"enable-benchmarking"; +const wchar_t kEnableBenchmarking[] = L"enable-benchmarking"; // The prefix used when starting the zygote process. (i.e. 'gdb --args') const wchar_t kZygoteCmdPrefix[] = L"zygote-cmd-prefix"; // Enables using ThumbnailStore instead of ThumbnailDatabase for setting and // getting thumbnails for the new tab page. -const wchar_t kThumbnailStore[] = L"thumbnail-store"; +const wchar_t kThumbnailStore[] = L"thumbnail-store"; // Experimental. Shows a dialog asking the user to try chrome. This flag // is to be used only by the upgrade process. -const wchar_t kTryChromeAgain[] = L"try-chrome-again"; +const wchar_t kTryChromeAgain[] = L"try-chrome-again"; // The file descriptor limit is set to the value of this switch, subject to the // OS hard limits. Useful for testing that file descriptor exhaustion is handled // gracefully. -const wchar_t kFileDescriptorLimit[] = L"file-descriptor-limit"; +const wchar_t kFileDescriptorLimit[] = L"file-descriptor-limit"; // On Windows, converts the page to the currently-installed monitor profile. // This does NOT enable color management for images. The source is still assumed diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index bfe9cdd..ee04a2c 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -180,6 +180,7 @@ extern const wchar_t kForceFieldTestNameAndValue[]; extern const wchar_t kNewTabPage[]; extern const wchar_t kOldNewTabPage[]; +extern const wchar_t kDisableNewTabFirstRun[]; extern const wchar_t kEnableWebResources[]; diff --git a/chrome/test/startup/feature_startup_test.cc b/chrome/test/startup/feature_startup_test.cc index 5224c9b..7cd044e 100644 --- a/chrome/test/startup/feature_startup_test.cc +++ b/chrome/test/startup/feature_startup_test.cc @@ -9,6 +9,7 @@ #include "base/time.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_switches.h" #include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/window_proxy.h" #include "chrome/test/ui/ui_test.h" @@ -55,6 +56,10 @@ class NewTabUIStartupTest : public UITest { // Install the location of the test profile file. set_template_user_data(ComputeTypicalUserDataSource().ToWStringHack()); + // Disable the first run notification because it has an animation which + // masks any real performance regressions. + launch_arguments_.AppendSwitch(switches::kDisableNewTabFirstRun); + TimeDelta timings[kNumCycles]; for (int i = 0; i < kNumCycles; ++i) { UITest::SetUp(); |