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

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

Issue 10827259: Change panels to use gfx::Image instead of SkBitmap for favicon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: applied change to panel_titlebar_gtk.cc after syncing Created 8 years, 4 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
« no previous file with comments | « chrome/browser/ui/panels/panel_host.h ('k') | chrome/browser/ui/panels/panel_titlebar_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/panels/panel_host.h" 5 #include "chrome/browser/ui/panels/panel_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/chrome_page_zoom.h" 10 #include "chrome/browser/chrome_page_zoom.h"
11 #include "chrome/browser/favicon/favicon_tab_helper.h" 11 #include "chrome/browser/favicon/favicon_tab_helper.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/panels/panel.h" 13 #include "chrome/browser/ui/panels/panel.h"
14 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" 14 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
15 #include "chrome/browser/view_type_utils.h" 15 #include "chrome/browser/view_type_utils.h"
16 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/common/extensions/extension_messages.h" 17 #include "chrome/common/extensions/extension_messages.h"
18 #include "content/public/browser/invalidate_type.h" 18 #include "content/public/browser/invalidate_type.h"
19 #include "content/public/browser/navigation_controller.h" 19 #include "content/public/browser/navigation_controller.h"
20 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
21 #include "content/public/browser/notification_source.h" 21 #include "content/public/browser/notification_source.h"
22 #include "content/public/browser/notification_types.h" 22 #include "content/public/browser/notification_types.h"
23 #include "content/public/browser/render_view_host.h" 23 #include "content/public/browser/render_view_host.h"
24 #include "content/public/browser/site_instance.h" 24 #include "content/public/browser/site_instance.h"
25 #include "content/public/browser/user_metrics.h" 25 #include "content/public/browser/user_metrics.h"
26 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
27 #include "ui/gfx/image/image.h" 27 #include "ui/gfx/image/image.h"
28 #include "ipc/ipc_message.h" 28 #include "ipc/ipc_message.h"
29 #include "ipc/ipc_message_macros.h" 29 #include "ipc/ipc_message_macros.h"
30 #include "third_party/skia/include/core/SkBitmap.h" 30 #include "ui/gfx/image/image.h"
31 #include "ui/gfx/rect.h" 31 #include "ui/gfx/rect.h"
32 32
33 using content::UserMetricsAction; 33 using content::UserMetricsAction;
34 34
35 PanelHost::PanelHost(Panel* panel, Profile* profile) 35 PanelHost::PanelHost(Panel* panel, Profile* profile)
36 : panel_(panel), 36 : panel_(panel),
37 profile_(profile), 37 profile_(profile),
38 extension_function_dispatcher_(profile, this), 38 extension_function_dispatcher_(profile, this),
39 weak_factory_(this) { 39 weak_factory_(this) {
40 } 40 }
(...skipping 18 matching lines...) Expand all
59 web_contents_->GetController().LoadURL( 59 web_contents_->GetController().LoadURL(
60 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); 60 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string());
61 } 61 }
62 62
63 void PanelHost::DestroyWebContents() { 63 void PanelHost::DestroyWebContents() {
64 favicon_tab_helper_.reset(); 64 favicon_tab_helper_.reset();
65 prefs_tab_helper_.reset(); 65 prefs_tab_helper_.reset();
66 web_contents_.reset(); 66 web_contents_.reset();
67 } 67 }
68 68
69 SkBitmap PanelHost::GetPageIcon() const { 69 gfx::Image PanelHost::GetPageIcon() const {
70 // TODO: Make this function return gfx::Image.
71 return favicon_tab_helper_.get() ? 70 return favicon_tab_helper_.get() ?
72 favicon_tab_helper_->GetFavicon().AsBitmap() : SkBitmap(); 71 favicon_tab_helper_->GetFavicon() : gfx::Image();
73 } 72 }
74 73
75 void PanelHost::NavigationStateChanged(const content::WebContents* source, 74 void PanelHost::NavigationStateChanged(const content::WebContents* source,
76 unsigned changed_flags) { 75 unsigned changed_flags) {
77 // Only need to update the title if the title changed while not loading, 76 // Only need to update the title if the title changed while not loading,
78 // because the title is also updated when loading state changes. 77 // because the title is also updated when loading state changes.
79 if ((changed_flags & content::INVALIDATE_TYPE_TAB) || 78 if ((changed_flags & content::INVALIDATE_TYPE_TAB) ||
80 ((changed_flags & content::INVALIDATE_TYPE_TITLE) && 79 ((changed_flags & content::INVALIDATE_TYPE_TITLE) &&
81 !source->IsLoading())) 80 !source->IsLoading()))
82 panel_->UpdateTitleBar(); 81 panel_->UpdateTitleBar();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 187 }
189 188
190 void PanelHost::StopLoading() { 189 void PanelHost::StopLoading() {
191 content::RecordAction(UserMetricsAction("Stop")); 190 content::RecordAction(UserMetricsAction("Stop"));
192 web_contents_->Stop(); 191 web_contents_->Stop();
193 } 192 }
194 193
195 void PanelHost::Zoom(content::PageZoom zoom) { 194 void PanelHost::Zoom(content::PageZoom zoom) {
196 chrome_page_zoom::Zoom(web_contents_.get(), zoom); 195 chrome_page_zoom::Zoom(web_contents_.get(), zoom);
197 } 196 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_host.h ('k') | chrome/browser/ui/panels/panel_titlebar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698