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

Side by Side Diff: extensions/browser/app_window/app_window.cc

Issue 557833007: Remove Increment/DecrementKeepAliveCount from AppsClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 2 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
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | extensions/browser/app_window/app_window_client.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/app_window/app_window.h" 5 #include "extensions/browser/app_window/app_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 native_app_window_.reset( 278 native_app_window_.reset(
279 app_window_client->CreateNativeAppWindow(this, new_params)); 279 app_window_client->CreateNativeAppWindow(this, new_params));
280 280
281 helper_.reset(new AppWebContentsHelper( 281 helper_.reset(new AppWebContentsHelper(
282 browser_context_, extension_id_, web_contents, app_delegate_.get())); 282 browser_context_, extension_id_, web_contents, app_delegate_.get()));
283 283
284 popup_manager_.reset( 284 popup_manager_.reset(
285 new web_modal::PopupManager(GetWebContentsModalDialogHost())); 285 new web_modal::PopupManager(GetWebContentsModalDialogHost()));
286 popup_manager_->RegisterWith(web_contents); 286 popup_manager_->RegisterWith(web_contents);
287 287
288 // Prevent the browser process from shutting down while this window exists.
289 app_window_client->IncrementKeepAliveCount();
290 UpdateExtensionAppIcon(); 288 UpdateExtensionAppIcon();
291 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); 289 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this);
292 290
293 if (new_params.hidden) { 291 if (new_params.hidden) {
294 // Although the window starts hidden by default, calling Hide() here 292 // Although the window starts hidden by default, calling Hide() here
295 // notifies observers of the window being hidden. 293 // notifies observers of the window being hidden.
296 Hide(); 294 Hide();
297 } else { 295 } else {
298 // Panels are not activated by default. 296 // Panels are not activated by default.
299 Show(window_type_is_panel() || !new_params.focused ? SHOW_INACTIVE 297 Show(window_type_is_panel() || !new_params.focused ? SHOW_INACTIVE
(...skipping 24 matching lines...) Expand all
324 // that to happen, we need to define a size for the content, otherwise the 322 // that to happen, we need to define a size for the content, otherwise the
325 // layout will happen in a 0x0 area. 323 // layout will happen in a 0x0 area.
326 gfx::Insets frame_insets = native_app_window_->GetFrameInsets(); 324 gfx::Insets frame_insets = native_app_window_->GetFrameInsets();
327 gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets); 325 gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets);
328 initial_bounds.Inset(frame_insets); 326 initial_bounds.Inset(frame_insets);
329 app_delegate_->ResizeWebContents(web_contents, initial_bounds.size()); 327 app_delegate_->ResizeWebContents(web_contents, initial_bounds.size());
330 } 328 }
331 } 329 }
332 330
333 AppWindow::~AppWindow() { 331 AppWindow::~AppWindow() {
334 // Unregister now to prevent getting notified if we're the last window open.
335 app_delegate_->SetTerminatingCallback(base::Closure());
336
337 ExtensionRegistry::Get(browser_context_)->RemoveObserver(this); 332 ExtensionRegistry::Get(browser_context_)->RemoveObserver(this);
338
339 // Remove shutdown prevention.
340 AppWindowClient::Get()->DecrementKeepAliveCount();
341 } 333 }
342 334
343 void AppWindow::RequestMediaAccessPermission( 335 void AppWindow::RequestMediaAccessPermission(
344 content::WebContents* web_contents, 336 content::WebContents* web_contents,
345 const content::MediaStreamRequest& request, 337 const content::MediaStreamRequest& request,
346 const content::MediaResponseCallback& callback) { 338 const content::MediaResponseCallback& callback) {
347 DCHECK_EQ(AppWindow::web_contents(), web_contents); 339 DCHECK_EQ(AppWindow::web_contents(), web_contents);
348 helper_->RequestMediaAccessPermission(request, callback); 340 helper_->RequestMediaAccessPermission(request, callback);
349 } 341 }
350 342
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 region.bounds.x(), 1064 region.bounds.x(),
1073 region.bounds.y(), 1065 region.bounds.y(),
1074 region.bounds.right(), 1066 region.bounds.right(),
1075 region.bounds.bottom(), 1067 region.bounds.bottom(),
1076 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); 1068 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
1077 } 1069 }
1078 return sk_region; 1070 return sk_region;
1079 } 1071 }
1080 1072
1081 } // namespace extensions 1073 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | extensions/browser/app_window/app_window_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698