| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/themes/browser_theme_provider.h" | 5 #include "chrome/browser/themes/browser_theme_provider.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/string_split.h" |
| 8 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/extensions_service.h" | 11 #include "chrome/browser/extensions/extensions_service.h" |
| 11 #include "chrome/browser/metrics/user_metrics.h" | 12 #include "chrome/browser/metrics/user_metrics.h" |
| 12 #include "chrome/browser/profile.h" | 13 #include "chrome/browser/profile.h" |
| 13 #include "chrome/browser/themes/browser_theme_pack.h" | 14 #include "chrome/browser/themes/browser_theme_pack.h" |
| 14 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 15 #include "chrome/common/notification_service.h" | 16 #include "chrome/common/notification_service.h" |
| 16 #include "chrome/common/notification_type.h" | 17 #include "chrome/common/notification_type.h" |
| 17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 if (vertical_string.empty()) | 355 if (vertical_string.empty()) |
| 355 return horizontal_string; | 356 return horizontal_string; |
| 356 if (horizontal_string.empty()) | 357 if (horizontal_string.empty()) |
| 357 return vertical_string; | 358 return vertical_string; |
| 358 return vertical_string + " " + horizontal_string; | 359 return vertical_string + " " + horizontal_string; |
| 359 } | 360 } |
| 360 | 361 |
| 361 // static | 362 // static |
| 362 int BrowserThemeProvider::StringToAlignment(const std::string& alignment) { | 363 int BrowserThemeProvider::StringToAlignment(const std::string& alignment) { |
| 363 std::vector<std::wstring> split; | 364 std::vector<std::wstring> split; |
| 364 SplitStringAlongWhitespace(UTF8ToWide(alignment), &split); | 365 base::SplitStringAlongWhitespace(UTF8ToWide(alignment), &split); |
| 365 | 366 |
| 366 int alignment_mask = 0; | 367 int alignment_mask = 0; |
| 367 for (std::vector<std::wstring>::iterator alignments(split.begin()); | 368 for (std::vector<std::wstring>::iterator alignments(split.begin()); |
| 368 alignments != split.end(); ++alignments) { | 369 alignments != split.end(); ++alignments) { |
| 369 std::string comp = WideToUTF8(*alignments); | 370 std::string comp = WideToUTF8(*alignments); |
| 370 const char* component = comp.c_str(); | 371 const char* component = comp.c_str(); |
| 371 | 372 |
| 372 if (base::strcasecmp(component, kAlignmentTop) == 0) | 373 if (base::strcasecmp(component, kAlignmentTop) == 0) |
| 373 alignment_mask |= BrowserThemeProvider::ALIGN_TOP; | 374 alignment_mask |= BrowserThemeProvider::ALIGN_TOP; |
| 374 else if (base::strcasecmp(component, kAlignmentBottom) == 0) | 375 else if (base::strcasecmp(component, kAlignmentBottom) == 0) |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 void BrowserThemeProvider::OnInfobarDisplayed() { | 624 void BrowserThemeProvider::OnInfobarDisplayed() { |
| 624 number_of_infobars_++; | 625 number_of_infobars_++; |
| 625 } | 626 } |
| 626 | 627 |
| 627 void BrowserThemeProvider::OnInfobarDestroyed() { | 628 void BrowserThemeProvider::OnInfobarDestroyed() { |
| 628 number_of_infobars_--; | 629 number_of_infobars_--; |
| 629 | 630 |
| 630 if (number_of_infobars_ == 0) | 631 if (number_of_infobars_ == 0) |
| 631 RemoveUnusedThemes(); | 632 RemoveUnusedThemes(); |
| 632 } | 633 } |
| OLD | NEW |