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

Side by Side Diff: chrome/browser/notifications/balloon_host.cc

Issue 2145002: Mac: Fix renderer idle cpu usage regression. (Closed)
Patch Set: rebase Created 10 years, 7 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
OLDNEW
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/notifications/balloon_host.h" 5 #include "chrome/browser/notifications/balloon_host.h"
6 6
7 #include "chrome/browser/browser_list.h" 7 #include "chrome/browser/browser_list.h"
8 #include "chrome/browser/in_process_webkit/webkit_context.h" 8 #include "chrome/browser/in_process_webkit/webkit_context.h"
9 #include "chrome/browser/extensions/extension_process_manager.h" 9 #include "chrome/browser/extensions/extension_process_manager.h"
10 #include "chrome/browser/notifications/balloon.h" 10 #include "chrome/browser/notifications/balloon.h"
11 #include "chrome/browser/profile.h" 11 #include "chrome/browser/profile.h"
12 #include "chrome/browser/renderer_host/render_view_host.h" 12 #include "chrome/browser/renderer_host/render_view_host.h"
13 #include "chrome/browser/renderer_host/site_instance.h" 13 #include "chrome/browser/renderer_host/site_instance.h"
14 #include "chrome/browser/renderer_preferences_util.h" 14 #include "chrome/browser/renderer_preferences_util.h"
15 #include "chrome/common/bindings_policy.h" 15 #include "chrome/common/bindings_policy.h"
16 #include "chrome/common/notification_service.h" 16 #include "chrome/common/notification_service.h"
17 #include "chrome/common/notification_type.h" 17 #include "chrome/common/notification_type.h"
18 #include "chrome/common/render_messages.h"
18 #include "chrome/common/renderer_preferences.h" 19 #include "chrome/common/renderer_preferences.h"
19 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
20 21
21 BalloonHost::BalloonHost(Balloon* balloon) 22 BalloonHost::BalloonHost(Balloon* balloon)
22 : render_view_host_(NULL), 23 : render_view_host_(NULL),
23 balloon_(balloon), 24 balloon_(balloon),
24 initialized_(false), 25 initialized_(false),
25 should_notify_on_disconnect_(false) { 26 should_notify_on_disconnect_(false) {
26 DCHECK(balloon_); 27 DCHECK(balloon_);
27 28
(...skipping 22 matching lines...) Expand all
50 WebPreferences prefs; 51 WebPreferences prefs;
51 prefs.allow_scripts_to_close_windows = true; 52 prefs.allow_scripts_to_close_windows = true;
52 return prefs; 53 return prefs;
53 } 54 }
54 55
55 void BalloonHost::Close(RenderViewHost* render_view_host) { 56 void BalloonHost::Close(RenderViewHost* render_view_host) {
56 balloon_->CloseByScript(); 57 balloon_->CloseByScript();
57 } 58 }
58 59
59 void BalloonHost::RenderViewCreated(RenderViewHost* render_view_host) { 60 void BalloonHost::RenderViewCreated(RenderViewHost* render_view_host) {
60 render_view_host->EnablePreferredSizeChangedMode(); 61 render_view_host->EnablePreferredSizeChangedMode(
62 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow);
61 } 63 }
62 64
63 void BalloonHost::RenderViewReady(RenderViewHost* render_view_host) { 65 void BalloonHost::RenderViewReady(RenderViewHost* render_view_host) {
64 should_notify_on_disconnect_ = true; 66 should_notify_on_disconnect_ = true;
65 NotificationService::current()->Notify( 67 NotificationService::current()->Notify(
66 NotificationType::NOTIFY_BALLOON_CONNECTED, 68 NotificationType::NOTIFY_BALLOON_CONNECTED,
67 Source<BalloonHost>(this), NotificationService::NoDetails()); 69 Source<BalloonHost>(this), NotificationService::NoDetails());
68 } 70 }
69 71
70 void BalloonHost::RenderViewGone(RenderViewHost* render_view_host) { 72 void BalloonHost::RenderViewGone(RenderViewHost* render_view_host) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 155
154 void BalloonHost::NotifyDisconnect() { 156 void BalloonHost::NotifyDisconnect() {
155 if (!should_notify_on_disconnect_) 157 if (!should_notify_on_disconnect_)
156 return; 158 return;
157 159
158 should_notify_on_disconnect_ = false; 160 should_notify_on_disconnect_ = false;
159 NotificationService::current()->Notify( 161 NotificationService::current()->Notify(
160 NotificationType::NOTIFY_BALLOON_DISCONNECTED, 162 NotificationType::NOTIFY_BALLOON_DISCONNECTED,
161 Source<BalloonHost>(this), NotificationService::NoDetails()); 163 Source<BalloonHost>(this), NotificationService::NoDetails());
162 } 164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698