From b924ae04055aa82cd19ef522b690e3cd66352c11 Mon Sep 17 00:00:00 2001 From: "aa@chromium.org" Date: Thu, 26 Aug 2010 06:05:31 +0000 Subject: Revert 57473 and 57476. Best. Programmer. Ever. TBR=eroman@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57478 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/app/generated_resources.grd | 5 +- chrome/app/theme/ntp_header_background.png | Bin 129 -> 0 bytes chrome/app/theme/ntp_header_background_active.png | Bin 784 -> 0 bytes chrome/app/theme/ntp_header_background_hover.png | Bin 129 -> 0 bytes chrome/app/theme/theme_resources.grd | 3 - chrome/browser/dom_ui/new_tab_ui.h | 2 +- chrome/browser/dom_ui/ntp_resource_cache.cc | 19 ++--- chrome/browser/dom_ui/shown_sections_handler.cc | 17 +++-- chrome/browser/dom_ui/shown_sections_handler.h | 3 +- chrome/browser/resources/new_new_tab.css | 81 ++++++++++++++------- chrome/browser/resources/new_new_tab.html | 33 ++++++--- chrome/browser/resources/new_new_tab.js | 16 +--- chrome/browser/resources/new_tab_theme.css | 33 ++++++--- chrome/browser/resources/ntp/apps.css | 3 +- chrome/browser/resources/ntp/apps.js | 20 ++++- .../resources/ntp/ntp_disclosure_triangle.png | Bin 195 -> 0 bytes chrome/browser/themes/browser_theme_provider.cc | 5 -- chrome/browser/themes/browser_theme_provider.h | 2 - 18 files changed, 138 insertions(+), 104 deletions(-) delete mode 100644 chrome/app/theme/ntp_header_background.png delete mode 100644 chrome/app/theme/ntp_header_background_active.png delete mode 100644 chrome/app/theme/ntp_header_background_hover.png delete mode 100644 chrome/browser/resources/ntp/ntp_disclosure_triangle.png diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index bf3411a..c2abbdb 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -6434,11 +6434,8 @@ Keep your key file in a safe place. You will need it to create new versions of y - - Apps - + desc="Title of the new tab page, this is only shown while loading, then the title comes from the page"> New Tab - - - diff --git a/chrome/browser/dom_ui/new_tab_ui.h b/chrome/browser/dom_ui/new_tab_ui.h index 35e2a87..e091fcf 100644 --- a/chrome/browser/dom_ui/new_tab_ui.h +++ b/chrome/browser/dom_ui/new_tab_ui.h @@ -96,7 +96,7 @@ class NewTabUI : public DOMUI, NotificationRegistrar registrar_; // The preference version. This used for migrating prefs of the NTP. - static const int current_pref_version_ = 3; + static const int current_pref_version_ = 2; DISALLOW_COPY_AND_ASSIGN(NewTabUI); }; diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc index 05868b7..e92ad6c 100644 --- a/chrome/browser/dom_ui/ntp_resource_cache.cc +++ b/chrome/browser/dom_ui/ntp_resource_cache.cc @@ -224,7 +224,6 @@ void NTPResourceCache::CreateNewTabIncognitoHTML() { void NTPResourceCache::CreateNewTabHTML() { // Show the profile name in the title and most visited labels if the current // profile is not the default. - string16 apps = l10n_util::GetStringUTF16(IDS_NEW_TAB_APPS); string16 title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); string16 most_visited = l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED); DictionaryValue localized_strings; @@ -234,7 +233,6 @@ void NTPResourceCache::CreateNewTabHTML() { localized_strings.SetString("hasattribution", profile_->GetThemeProvider()->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION) ? "true" : "false"); - localized_strings.SetString("apps", apps); localized_strings.SetString("title", title); localized_strings.SetString("mostvisited", most_visited); localized_strings.SetString("restorethumbnails", @@ -398,10 +396,6 @@ void NTPResourceCache::CreateNewTabCSS() { tp->GetColor(BrowserThemeProvider::COLOR_NTP_SECTION_LINK); SkColor color_section_link_underline = tp->GetColor(BrowserThemeProvider::COLOR_NTP_SECTION_LINK_UNDERLINE); - SkColor color_section_header_text = - tp->GetColor(BrowserThemeProvider::COLOR_NTP_SECTION_HEADER_TEXT); - SkColor color_section_header_text_hover = - tp->GetColor(BrowserThemeProvider::COLOR_NTP_SECTION_HEADER_TEXT_HOVER); SkColor color_header = tp->GetColor(BrowserThemeProvider::COLOR_NTP_HEADER); @@ -449,9 +443,6 @@ void NTPResourceCache::CreateNewTabCSS() { tp->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION) ? "block" : "none"); // $$5 subst2.push_back(SkColorToRGBAString(color_link_underline)); // $$6 subst2.push_back(SkColorToRGBAString(color_section_link_underline)); // $$7 - subst2.push_back(SkColorToRGBAString(color_section_header_text)); // $$8 - subst2.push_back(SkColorToRGBAString( - color_section_header_text_hover)); // $$9 // Get our template. static const base::StringPiece new_tab_theme_css( @@ -459,12 +450,12 @@ void NTPResourceCache::CreateNewTabCSS() { IDR_NEW_TAB_THEME_CSS)); // Create the string from our template and the replacements. - std::string css_string; - css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); - css_string = ReplaceStringPlaceholders(css_string, subst2, NULL); + const std::string css_string = ReplaceStringPlaceholders( + new_tab_theme_css, subst, NULL); + std::string full_css = ReplaceStringPlaceholders(css_string, subst2, NULL); new_tab_css_ = new RefCountedBytes; - new_tab_css_->data.resize(css_string.size()); - std::copy(css_string.begin(), css_string.end(), + new_tab_css_->data.resize(full_css.size()); + std::copy(full_css.begin(), full_css.end(), new_tab_css_->data.begin()); } diff --git a/chrome/browser/dom_ui/shown_sections_handler.cc b/chrome/browser/dom_ui/shown_sections_handler.cc index c46724d..2bb3d82 100644 --- a/chrome/browser/dom_ui/shown_sections_handler.cc +++ b/chrome/browser/dom_ui/shown_sections_handler.cc @@ -89,7 +89,7 @@ void ShownSectionsHandler::HandleSetShownSections(const ListValue* args) { // static void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { pref_service->RegisterIntegerPref(prefs::kNTPShownSections, - THUMB | RECENT | TIPS | SYNC | APPS); + THUMB | RECENT | TIPS | SYNC); } // static @@ -99,10 +99,17 @@ void ShownSectionsHandler::MigrateUserPrefs(PrefService* pref_service, bool changed = false; int shown_sections = pref_service->GetInteger(prefs::kNTPShownSections); - if (old_pref_version < 3) { - // At version 3, we added apps. To bring attention to the feature, we start - // it off as the only expanded section. - shown_sections = APPS; + if (old_pref_version < 1) { + // TIPS was used in early builds of the NNTP but since it was removed before + // Chrome 3.0 we want to ensure that it is shown by default. + shown_sections |= TIPS | SYNC; + changed = true; + } + + if (old_pref_version < 2) { + // LIST is no longer used. Change to THUMB. + shown_sections &= ~LIST; + shown_sections |= THUMB; changed = true; } diff --git a/chrome/browser/dom_ui/shown_sections_handler.h b/chrome/browser/dom_ui/shown_sections_handler.h index e097c71..afe1e26 100644 --- a/chrome/browser/dom_ui/shown_sections_handler.h +++ b/chrome/browser/dom_ui/shown_sections_handler.h @@ -20,8 +20,7 @@ enum Section { RECENT = 4, TIPS = 8, SYNC = 16, - DEBUG = 32, - APPS = 64 + DEBUG = 32 }; class ShownSectionsHandler : public DOMMessageHandler, diff --git a/chrome/browser/resources/new_new_tab.css b/chrome/browser/resources/new_new_tab.css index fe76ed2..80d991c 100644 --- a/chrome/browser/resources/new_new_tab.css +++ b/chrome/browser/resources/new_new_tab.css @@ -18,9 +18,10 @@ html[mode=app-launcher] { #main { -webkit-box-sizing: border-box; -webkit-transition: width .15s; + background: url(chrome://theme/IDR_PRODUCT_LOGO) no-repeat 0 6px; margin: 0 auto; min-height: 100%; - padding:10px 0 20px; + padding-bottom: 25px; /* Make room for the bottom positioned footer. */ position: relative; width: 920px; } @@ -214,10 +215,6 @@ html[dir=rtl] .item { max-width: none !important; } -#most-visited { - margin-bottom: 20px; -} - .nav > a { /* no icon */ padding: 0; @@ -248,6 +245,12 @@ html[dir=rtl] .item { margin: 0 10px; } +#top-bar { + display: -webkit-box; + -webkit-box-align: center; + min-height: 56px; +} + .notification.hidden { opacity: 0; pointer-events: none; @@ -337,6 +340,11 @@ html[dir=rtl] #option-menu > [command=hide]:before { font-family: inherit; } +#apps-section { + padding: 10px 0px; + border-top: 0; +} + #apps-launch-control { margin-top: 10px; } @@ -360,37 +368,29 @@ html[dir=rtl] #option-menu > [command=hide]:before { display: none !important; } +.section + :not(.hidden) { + border-top: 0; +} + .section > div { margin-bottom: 10px; } .section > h2 { - background-position: 0 center; - background-repeat: no-repeat; - -webkit-background-size: 100% 26px; + display: inline-block; + margin: 0; + font-size: 100%; cursor: pointer; - display: block; - font-family: Helvetica, Arial, sans-serif; - font-size: 16px; - font-weight: normal; - margin:10px 0; - -webkit-margin-collapse: separate; -} - -.section > h2 > img { - margin-left:-13px; - padding-right:4px; -} - -.section:not(.hidden) > h2 > img { - -webkit-transform:rotate(90deg); + margin-top: 10px; + margin-bottom: 10px; } -.section > h2 > span { - padding-right: 4px; +.section > h2:hover { + text-decoration: underline; } .section.hidden { + display: inline; border: 0; } @@ -398,6 +398,10 @@ html[dir=rtl] #option-menu > [command=hide]:before { display: none !important; } +.section > h2 { + margin-right: 5px; +} + .section.hidden > h2 { margin-right: 0px; } @@ -406,6 +410,10 @@ html[dir=rtl] #option-menu > [command=hide]:before { border-right: 0; } +.section.hidden + .hidden > h2 { + padding-left: 5px; +} + .section:last-child { border-bottom: 0; } @@ -414,6 +422,10 @@ html[dir=rtl] #option-menu > [command=hide]:before { display: inline-block; } +#apps { + margin-top: 10px; +} + .section > * { font-size: 12px; } @@ -442,3 +454,22 @@ html[dir=rtl] #option-menu > [command=hide]:before { margin-right: 10px; } } + +#footer { + bottom: 0; + padding-bottom: 5px; + position: absolute; + text-align: end; + width: 100%; +} + +#footer hr { + border: 0; + display: inline; + margin: 0; + padding: 0; +} + +#footer hr:after { + content: "|"; +} diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html index 0c04940..c8a01b5 100644 --- a/chrome/browser/resources/new_new_tab.html +++ b/chrome/browser/resources/new_new_tab.html @@ -71,8 +71,7 @@ var Section = { RECENT: 4, // TIPS is no longer used SYNC: 16, - DEBUG: 32, - APPS: 64 + DEBUG: 32 }; var shownSections = templateData['shown_sections']; @@ -126,6 +125,11 @@ if ('mode' in hashParams) {
+
+ +
+
@@ -140,25 +144,20 @@ if ('mode' in hashParams) {
-
-

-
-
+
-

+

-

+

-

Debug

+

Debug

Open apps in:
+ +
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js index c0f32bf..b9404a6 100644 --- a/chrome/browser/resources/new_new_tab.js +++ b/chrome/browser/resources/new_new_tab.js @@ -587,9 +587,6 @@ OptionMenu.prototype = { } }; -// TODO(aa): The 'clear-all-blacklisted' feature needs to move into a menu in -// the most visited section. -/* var optionMenu = new OptionMenu($('option-button'), $('option-menu')); optionMenu.commands = { 'clear-all-blacklisted' : function() { @@ -607,16 +604,10 @@ optionMenu.commands = { saveShownSections(); } }; -*/ $('main').addEventListener('click', function(e) { - var p = e.target; - while (p && p.tagName != 'H2') { - p = p.parentNode; - } - - if (p) { - p = p.parentNode; + if (e.target.tagName == 'H2') { + var p = e.target.parentNode; var section = p.getAttribute('section'); if (section) { if (shownSections & Section[section]) @@ -815,8 +806,7 @@ function callGetSyncMessageIfSyncIsPresent() { } function hideAllMenus() { - // TODO(aa): See comment in definition of optionMenu. - //optionMenu.hide(); + optionMenu.hide(); } window.addEventListener('blur', hideAllMenus); diff --git a/chrome/browser/resources/new_tab_theme.css b/chrome/browser/resources/new_tab_theme.css index 7597812..150d3be 100644 --- a/chrome/browser/resources/new_tab_theme.css +++ b/chrome/browser/resources/new_tab_theme.css @@ -16,8 +16,10 @@ body { overflow: auto; } -/* TODO(aa): Is this still in use? The styling may be incorrect with M7 NTP - rework. */ +#main { + background: url(chrome://theme/IDR_PRODUCT_LOGO?$1) no-repeat 0 8px; +} + #notification.first-run { background-color: $$1; /* COLOR_NTP_SECTION */ border-color: $$2; /* COLOR_NTP_SECTION_BORDER */ @@ -105,22 +107,25 @@ body { color: $$6; /* COLOR_NTP_LINK_UNDERLINE */ } -.section > h2 { - color: $$8; /* COLOR_NTP_SECTION_HEADER_TEXT */ - background-image: url(chrome://theme/IDR_NEWTAB_SECTION_HEADER_BACKGROUND); +#top-bar { + border-bottom: 1px solid $$2; /* COLOR_NTP_SECTION_BORDER */ } -.section > h2:hover { - color: $$9; - background-image: url(chrome://theme/IDR_NEWTAB_SECTION_HEADER_BACKGROUND_H); +.section { + border-top: 1px solid $$2; /* COLOR_NTP_SECTION_BORDER */ + border-bottom: 1px solid $$2; /* COLOR_NTP_SECTION_BORDER */ } -.section:not(.hidden) > h2 { - background-image: url(chrome://theme/IDR_NEWTAB_SECTION_HEADER_BACKGROUND_A); +.section.hidden + :not(.hidden) { + border-top: 1px solid $$2; /* COLOR_NTP_SECTION_BORDER */; } -.section > h2 > span { - background: $2; /* COLOR_NTP_BACKGROUND */ +.section.hidden + .hidden > h2 { + border-left: 1px solid $$2; /* COLOR_NTP_SECTION_BORDER */ +} + +.section > h2 { + color: $8; /* COLOR_NTP_TEXT */ } #apps-section a { @@ -132,3 +137,7 @@ body { color: $$3; /* COLOR_NTP_SECTION_TEXT */ background-color: $$1; /* COLOR_NTP_SECTION */; } + +#footer hr { + color: $$2; /* COLOR_NTP_SECTION_BORDER */ +} diff --git a/chrome/browser/resources/ntp/apps.css b/chrome/browser/resources/ntp/apps.css index 3acaedd..67c7b70 100644 --- a/chrome/browser/resources/ntp/apps.css +++ b/chrome/browser/resources/ntp/apps.css @@ -35,8 +35,7 @@ background: rgba(255, 255, 255, 0) /* transparent white */ no-repeat center 10px; background-size: 96px 96px; - font-family: Helvetica, Arial; - font-size: 14px; + font-weight: bold; overflow: hidden; padding: 111px 10px 10px; /* 10 + 96 + 5 */ text-align: center; diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js index 64b490f..41c2e6e 100644 --- a/chrome/browser/resources/ntp/apps.js +++ b/chrome/browser/resources/ntp/apps.js @@ -5,14 +5,26 @@ function getAppsCallback(data) { logEvent('recieved apps'); var appsSection = $('apps-section'); - var appsSectionContent = $('apps-section-content'); - appsSectionContent.textContent = ''; + var debugSection = $('debug'); + appsSection.textContent = ''; data.apps.forEach(function(app) { - appsSectionContent.appendChild(apps.createElement(app)); + appsSection.appendChild(apps.createElement(app)); }); - appsSectionContent.appendChild(apps.createWebStoreElement()); + // TODO(aa): Figure out what to do with the debug mode when we turn apps on + // for everyone. + if (appsSection.hasChildNodes()) { + appsSection.classList.remove('disabled'); + if (data.showDebugLink) { + debugSection.classList.remove('disabled'); + } + + appsSection.appendChild(apps.createWebStoreElement()); + } else { + appsSection.classList.add('disabled'); + debugSection.classList.add('disabled'); + } } var apps = { diff --git a/chrome/browser/resources/ntp/ntp_disclosure_triangle.png b/chrome/browser/resources/ntp/ntp_disclosure_triangle.png deleted file mode 100644 index 6f5c016..0000000 Binary files a/chrome/browser/resources/ntp/ntp_disclosure_triangle.png and /dev/null differ diff --git a/chrome/browser/themes/browser_theme_provider.cc b/chrome/browser/themes/browser_theme_provider.cc index 55a1c17..74bddfa 100644 --- a/chrome/browser/themes/browser_theme_provider.cc +++ b/chrome/browser/themes/browser_theme_provider.cc @@ -79,7 +79,6 @@ const SkColor kDefaultColorNTPHeader = SkColorSetRGB(75, 140, 220); const SkColor kDefaultColorNTPSection = SkColorSetRGB(229, 239, 254); const SkColor kDefaultColorNTPSectionText = SK_ColorBLACK; const SkColor kDefaultColorNTPSectionLink = SkColorSetRGB(6, 55, 116); -const SkColor kDefaultColorNTPSectionHeaderText = SkColorSetRGB(76, 76, 76); const SkColor kDefaultColorControlBackground = SkColorSetARGB(0, 0, 0, 0); const SkColor kDefaultColorButtonBackground = SkColorSetARGB(0, 0, 0, 0); #if defined(OS_MACOSX) @@ -445,10 +444,6 @@ SkColor BrowserThemeProvider::GetDefaultColor(int id) { return kDefaultColorNTPSectionLink; case COLOR_NTP_SECTION_LINK_UNDERLINE: return TintForUnderline(kDefaultColorNTPSectionLink); - case COLOR_NTP_SECTION_HEADER_TEXT: - return kDefaultColorNTPSectionHeaderText; - case COLOR_NTP_SECTION_HEADER_TEXT_HOVER: - return kDefaultColorNTPText; case COLOR_CONTROL_BACKGROUND: return kDefaultColorControlBackground; case COLOR_BUTTON_BACKGROUND: diff --git a/chrome/browser/themes/browser_theme_provider.h b/chrome/browser/themes/browser_theme_provider.h index 32734cc..565047e 100644 --- a/chrome/browser/themes/browser_theme_provider.h +++ b/chrome/browser/themes/browser_theme_provider.h @@ -72,8 +72,6 @@ class BrowserThemeProvider : public NonThreadSafe, COLOR_NTP_LINK_UNDERLINE, COLOR_NTP_HEADER, COLOR_NTP_SECTION, - COLOR_NTP_SECTION_HEADER_TEXT, - COLOR_NTP_SECTION_HEADER_TEXT_HOVER, COLOR_NTP_SECTION_TEXT, COLOR_NTP_SECTION_LINK, COLOR_NTP_SECTION_LINK_UNDERLINE, -- cgit v1.1