Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 6814029: Revert 80519 - Move favicon from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 30 matching lines...) Expand all
41 #include "chrome/browser/download/download_shelf.h" 41 #include "chrome/browser/download/download_shelf.h"
42 #include "chrome/browser/download/download_started_animation.h" 42 #include "chrome/browser/download/download_started_animation.h"
43 #include "chrome/browser/extensions/crx_installer.h" 43 #include "chrome/browser/extensions/crx_installer.h"
44 #include "chrome/browser/extensions/extension_browser_event_router.h" 44 #include "chrome/browser/extensions/extension_browser_event_router.h"
45 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" 45 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h"
46 #include "chrome/browser/extensions/extension_host.h" 46 #include "chrome/browser/extensions/extension_host.h"
47 #include "chrome/browser/extensions/extension_prefs.h" 47 #include "chrome/browser/extensions/extension_prefs.h"
48 #include "chrome/browser/extensions/extension_service.h" 48 #include "chrome/browser/extensions/extension_service.h"
49 #include "chrome/browser/extensions/extension_tab_helper.h" 49 #include "chrome/browser/extensions/extension_tab_helper.h"
50 #include "chrome/browser/extensions/extension_tabs_module.h" 50 #include "chrome/browser/extensions/extension_tabs_module.h"
51 #include "chrome/browser/favicon_tab_helper.h"
52 #include "chrome/browser/first_run/first_run.h" 51 #include "chrome/browser/first_run/first_run.h"
53 #include "chrome/browser/google/google_url_tracker.h" 52 #include "chrome/browser/google/google_url_tracker.h"
54 #include "chrome/browser/google/google_util.h" 53 #include "chrome/browser/google/google_util.h"
55 #include "chrome/browser/instant/instant_controller.h" 54 #include "chrome/browser/instant/instant_controller.h"
56 #include "chrome/browser/instant/instant_unload_handler.h" 55 #include "chrome/browser/instant/instant_unload_handler.h"
57 #include "chrome/browser/metrics/user_metrics.h" 56 #include "chrome/browser/metrics/user_metrics.h"
58 #include "chrome/browser/net/browser_url_util.h" 57 #include "chrome/browser/net/browser_url_util.h"
59 #include "chrome/browser/net/url_fixer_upper.h" 58 #include "chrome/browser/net/url_fixer_upper.h"
60 #include "chrome/browser/notifications/notification_ui_manager.h" 59 #include "chrome/browser/notifications/notification_ui_manager.h"
61 #include "chrome/browser/platform_util.h" 60 #include "chrome/browser/platform_util.h"
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 806
808 // An explicit maximized state was not set. Query the window sizer. 807 // An explicit maximized state was not set. Query the window sizer.
809 gfx::Rect restored_bounds; 808 gfx::Rect restored_bounds;
810 bool maximized = false; 809 bool maximized = false;
811 WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, this, 810 WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, this,
812 &restored_bounds, &maximized); 811 &restored_bounds, &maximized);
813 return maximized; 812 return maximized;
814 } 813 }
815 814
816 SkBitmap Browser::GetCurrentPageIcon() const { 815 SkBitmap Browser::GetCurrentPageIcon() const {
817 TabContentsWrapper* contents = GetSelectedTabContentsWrapper(); 816 TabContents* contents = GetSelectedTabContents();
818 // |contents| can be NULL since GetCurrentPageIcon() is called by the window 817 // |contents| can be NULL since GetCurrentPageIcon() is called by the window
819 // during the window's creation (before tabs have been added). 818 // during the window's creation (before tabs have been added).
820 return contents ? contents->favicon_tab_helper()->GetFavicon() : SkBitmap(); 819 return contents ? contents->GetFavicon() : SkBitmap();
821 } 820 }
822 821
823 string16 Browser::GetWindowTitleForCurrentTab() const { 822 string16 Browser::GetWindowTitleForCurrentTab() const {
824 TabContents* contents = GetSelectedTabContents(); 823 TabContents* contents = GetSelectedTabContents();
825 string16 title; 824 string16 title;
826 825
827 // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the 826 // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the
828 // window during the window's creation (before tabs have been added). 827 // window during the window's creation (before tabs have been added).
829 if (contents) { 828 if (contents) {
830 title = contents->GetTitle(); 829 title = contents->GetTitle();
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 1581
1583 void Browser::BookmarkCurrentPage() { 1582 void Browser::BookmarkCurrentPage() {
1584 UserMetrics::RecordAction(UserMetricsAction("Star"), profile_); 1583 UserMetrics::RecordAction(UserMetricsAction("Star"), profile_);
1585 1584
1586 BookmarkModel* model = profile()->GetBookmarkModel(); 1585 BookmarkModel* model = profile()->GetBookmarkModel();
1587 if (!model || !model->IsLoaded()) 1586 if (!model || !model->IsLoaded())
1588 return; // Ignore requests until bookmarks are loaded. 1587 return; // Ignore requests until bookmarks are loaded.
1589 1588
1590 GURL url; 1589 GURL url;
1591 string16 title; 1590 string16 title;
1592 TabContentsWrapper* tab = GetSelectedTabContentsWrapper(); 1591 TabContents* tab = GetSelectedTabContents();
1593 bookmark_utils::GetURLAndTitleToBookmark(tab->tab_contents(), &url, &title); 1592 bookmark_utils::GetURLAndTitleToBookmark(tab, &url, &title);
1594 bool was_bookmarked = model->IsBookmarked(url); 1593 bool was_bookmarked = model->IsBookmarked(url);
1595 if (!was_bookmarked && profile_->IsOffTheRecord()) { 1594 if (!was_bookmarked && profile_->IsOffTheRecord()) {
1596 // If we're incognito the favicon may not have been saved. Save it now 1595 // If we're incognito the favicon may not have been saved. Save it now
1597 // so that bookmarks have an icon for the page. 1596 // so that bookmarks have an icon for the page.
1598 tab->favicon_tab_helper()->SaveFavicon(); 1597 tab->SaveFavicon();
1599 } 1598 }
1600 model->SetURLStarred(url, title, true); 1599 model->SetURLStarred(url, title, true);
1601 // Make sure the model actually added a bookmark before showing the star. A 1600 // Make sure the model actually added a bookmark before showing the star. A
1602 // bookmark isn't created if the url is invalid. 1601 // bookmark isn't created if the url is invalid.
1603 if (window_->IsActive() && model->IsBookmarked(url)) { 1602 if (window_->IsActive() && model->IsBookmarked(url)) {
1604 // Only show the bubble if the window is active, otherwise we may get into 1603 // Only show the bubble if the window is active, otherwise we may get into
1605 // weird situations were the bubble is deleted as soon as it is shown. 1604 // weird situations were the bubble is deleted as soon as it is shown.
1606 window_->ShowBookmarkBubble(url, was_bookmarked); 1605 window_->ShowBookmarkBubble(url, was_bookmarked);
1607 } 1606 }
1608 } 1607 }
(...skipping 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after
4416 // The page transition below is only for the purpose of inserting the tab. 4415 // The page transition below is only for the purpose of inserting the tab.
4417 browser->AddTab(view_source_contents, PageTransition::LINK); 4416 browser->AddTab(view_source_contents, PageTransition::LINK);
4418 } 4417 }
4419 4418
4420 if (profile_->HasSessionService()) { 4419 if (profile_->HasSessionService()) {
4421 SessionService* session_service = profile_->GetSessionService(); 4420 SessionService* session_service = profile_->GetSessionService();
4422 if (session_service) 4421 if (session_service)
4423 session_service->TabRestored(&view_source_contents->controller(), false); 4422 session_service->TabRestored(&view_source_contents->controller(), false);
4424 } 4423 }
4425 } 4424 }
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager_resource_providers.cc ('k') | chrome/browser/ui/cocoa/hung_renderer_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698