| 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/views/frame/glass_browser_frame_view.h" | 5 #include "chrome/browser/views/frame/glass_browser_frame_view.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/gfx/icon_util.h" |
| 8 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 9 #include "app/theme_provider.h" | 10 #include "app/theme_provider.h" |
| 10 #include "chrome/app/chrome_dll_resource.h" | 11 #include "chrome/app/chrome_dll_resource.h" |
| 11 #include "chrome/browser/browser_theme_provider.h" | 12 #include "chrome/browser/browser_theme_provider.h" |
| 12 #include "chrome/browser/views/frame/browser_view.h" | 13 #include "chrome/browser/views/frame/browser_view.h" |
| 13 #include "chrome/browser/views/tabs/side_tab_strip.h" | 14 #include "chrome/browser/views/tabs/side_tab_strip.h" |
| 14 #include "chrome/browser/views/tabs/tab_strip.h" | 15 #include "chrome/browser/views/tabs/tab_strip.h" |
| 15 #include "grit/app_resources.h" | 16 #include "grit/app_resources.h" |
| 16 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
| 17 #include "views/window/client_view.h" | 18 #include "views/window/client_view.h" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 SendMessage(frame_->GetWindow()->GetNativeWindow(), WM_SETICON, | 405 SendMessage(frame_->GetWindow()->GetNativeWindow(), WM_SETICON, |
| 405 static_cast<WPARAM>(ICON_SMALL), | 406 static_cast<WPARAM>(ICON_SMALL), |
| 406 reinterpret_cast<LPARAM>(throbber_icons_[throbber_frame_])); | 407 reinterpret_cast<LPARAM>(throbber_icons_[throbber_frame_])); |
| 407 } | 408 } |
| 408 } | 409 } |
| 409 | 410 |
| 410 void GlassBrowserFrameView::StopThrobber() { | 411 void GlassBrowserFrameView::StopThrobber() { |
| 411 if (throbber_running_) { | 412 if (throbber_running_) { |
| 412 throbber_running_ = false; | 413 throbber_running_ = false; |
| 413 | 414 |
| 415 HICON frame_icon = NULL; |
| 416 |
| 417 // Check if hosted BrowserView has a window icon to use. |
| 418 if (browser_view_->ShouldShowWindowIcon()) { |
| 419 SkBitmap icon = browser_view_->GetWindowIcon(); |
| 420 if (!icon.isNull()) |
| 421 frame_icon = IconUtil::CreateHICONFromSkBitmap(icon); |
| 422 } |
| 423 |
| 424 // Fallback to class icon. |
| 425 if (!frame_icon) { |
| 426 frame_icon = reinterpret_cast<HICON>(GetClassLongPtr( |
| 427 frame_->GetWindow()->GetNativeWindow(), GCLP_HICONSM)); |
| 428 } |
| 429 |
| 414 // This will reset the small icon which we set in the throbber code. | 430 // This will reset the small icon which we set in the throbber code. |
| 415 // Windows will then pick up the default icon from the window class. | 431 // WM_SETICON with NULL icon restores the icon for title bar but not |
| 432 // for taskbar. See http://crbug.com/29996 |
| 416 SendMessage(frame_->GetWindow()->GetNativeWindow(), WM_SETICON, | 433 SendMessage(frame_->GetWindow()->GetNativeWindow(), WM_SETICON, |
| 417 static_cast<WPARAM>(ICON_SMALL), NULL); | 434 static_cast<WPARAM>(ICON_SMALL), |
| 435 reinterpret_cast<LPARAM>(frame_icon)); |
| 418 } | 436 } |
| 419 } | 437 } |
| 420 | 438 |
| 421 void GlassBrowserFrameView::DisplayNextThrobberFrame() { | 439 void GlassBrowserFrameView::DisplayNextThrobberFrame() { |
| 422 throbber_frame_ = (throbber_frame_ + 1) % kThrobberIconCount; | 440 throbber_frame_ = (throbber_frame_ + 1) % kThrobberIconCount; |
| 423 SendMessage(frame_->GetWindow()->GetNativeWindow(), WM_SETICON, | 441 SendMessage(frame_->GetWindow()->GetNativeWindow(), WM_SETICON, |
| 424 static_cast<WPARAM>(ICON_SMALL), | 442 static_cast<WPARAM>(ICON_SMALL), |
| 425 reinterpret_cast<LPARAM>(throbber_icons_[throbber_frame_])); | 443 reinterpret_cast<LPARAM>(throbber_icons_[throbber_frame_])); |
| 426 } | 444 } |
| 427 | 445 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 443 static bool initialized = false; | 461 static bool initialized = false; |
| 444 if (!initialized) { | 462 if (!initialized) { |
| 445 #if defined(GOOGLE_CHROME_BUILD) | 463 #if defined(GOOGLE_CHROME_BUILD) |
| 446 distributor_logo_ = ResourceBundle::GetSharedInstance(). | 464 distributor_logo_ = ResourceBundle::GetSharedInstance(). |
| 447 GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); | 465 GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); |
| 448 #endif | 466 #endif |
| 449 | 467 |
| 450 initialized = true; | 468 initialized = true; |
| 451 } | 469 } |
| 452 } | 470 } |
| OLD | NEW |