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

Side by Side Diff: apps/app_window.cc

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 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 | « apps/app_restore_service_browsertest.cc ('k') | apps/saved_files_service.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 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 "apps/app_window.h" 5 #include "apps/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 21 matching lines...) Expand all
32 #include "content/public/browser/notification_source.h" 32 #include "content/public/browser/notification_source.h"
33 #include "content/public/browser/notification_types.h" 33 #include "content/public/browser/notification_types.h"
34 #include "content/public/browser/render_view_host.h" 34 #include "content/public/browser/render_view_host.h"
35 #include "content/public/browser/resource_dispatcher_host.h" 35 #include "content/public/browser/resource_dispatcher_host.h"
36 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
37 #include "content/public/common/content_switches.h" 37 #include "content/public/common/content_switches.h"
38 #include "content/public/common/media_stream_request.h" 38 #include "content/public/common/media_stream_request.h"
39 #include "extensions/browser/extension_registry.h" 39 #include "extensions/browser/extension_registry.h"
40 #include "extensions/browser/extension_system.h" 40 #include "extensions/browser/extension_system.h"
41 #include "extensions/browser/extensions_browser_client.h" 41 #include "extensions/browser/extensions_browser_client.h"
42 #include "extensions/browser/notification_types.h"
42 #include "extensions/browser/process_manager.h" 43 #include "extensions/browser/process_manager.h"
43 #include "extensions/browser/view_type_utils.h" 44 #include "extensions/browser/view_type_utils.h"
44 #include "extensions/common/extension.h" 45 #include "extensions/common/extension.h"
45 #include "extensions/common/extension_messages.h" 46 #include "extensions/common/extension_messages.h"
46 #include "extensions/common/manifest_handlers/icons_handler.h" 47 #include "extensions/common/manifest_handlers/icons_handler.h"
47 #include "extensions/common/permissions/permissions_data.h" 48 #include "extensions/common/permissions/permissions_data.h"
48 #include "grit/theme_resources.h" 49 #include "grit/theme_resources.h"
49 #include "third_party/skia/include/core/SkRegion.h" 50 #include "third_party/skia/include/core/SkRegion.h"
50 #include "ui/base/resource/resource_bundle.h" 51 #include "ui/base/resource/resource_bundle.h"
51 #include "ui/gfx/screen.h" 52 #include "ui/gfx/screen.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 320
320 OnNativeWindowChanged(); 321 OnNativeWindowChanged();
321 322
322 // When the render view host is changed, the native window needs to know 323 // When the render view host is changed, the native window needs to know
323 // about it in case it has any setup to do to make the renderer appear 324 // about it in case it has any setup to do to make the renderer appear
324 // properly. In particular, on Windows, the view's clickthrough region needs 325 // properly. In particular, on Windows, the view's clickthrough region needs
325 // to be set. 326 // to be set.
326 extensions::ExtensionsBrowserClient* client = 327 extensions::ExtensionsBrowserClient* client =
327 extensions::ExtensionsBrowserClient::Get(); 328 extensions::ExtensionsBrowserClient::Get();
328 registrar_.Add(this, 329 registrar_.Add(this,
329 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 330 extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
330 content::Source<content::BrowserContext>( 331 content::Source<content::BrowserContext>(
331 client->GetOriginalContext(browser_context_))); 332 client->GetOriginalContext(browser_context_)));
332 // Close when the browser process is exiting. 333 // Close when the browser process is exiting.
333 registrar_.Add(this, 334 registrar_.Add(this,
334 chrome::NOTIFICATION_APP_TERMINATING, 335 chrome::NOTIFICATION_APP_TERMINATING,
335 content::NotificationService::AllSources()); 336 content::NotificationService::AllSources());
336 // Update the app menu if an ephemeral app becomes installed. 337 // Update the app menu if an ephemeral app becomes installed.
337 registrar_.Add(this, 338 registrar_.Add(
338 chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, 339 this,
339 content::Source<content::BrowserContext>( 340 extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED,
340 client->GetOriginalContext(browser_context_))); 341 content::Source<content::BrowserContext>(
342 client->GetOriginalContext(browser_context_)));
341 343
342 app_window_contents_->LoadContents(new_params.creator_process_id); 344 app_window_contents_->LoadContents(new_params.creator_process_id);
343 345
344 if (CommandLine::ForCurrentProcess()->HasSwitch( 346 if (CommandLine::ForCurrentProcess()->HasSwitch(
345 switches::kEnableAppsShowOnFirstPaint)) { 347 switches::kEnableAppsShowOnFirstPaint)) {
346 // We want to show the window only when the content has been painted. For 348 // We want to show the window only when the content has been painted. For
347 // that to happen, we need to define a size for the content, otherwise the 349 // that to happen, we need to define a size for the content, otherwise the
348 // layout will happen in a 0x0 area. 350 // layout will happen in a 0x0 area.
349 gfx::Insets frame_insets = native_app_window_->GetFrameInsets(); 351 gfx::Insets frame_insets = native_app_window_->GetFrameInsets();
350 gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets); 352 gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets);
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 991
990 bool AppWindow::IsFullscreenForTabOrPending(const content::WebContents* source) 992 bool AppWindow::IsFullscreenForTabOrPending(const content::WebContents* source)
991 const { 993 const {
992 return IsHtmlApiFullscreen(); 994 return IsHtmlApiFullscreen();
993 } 995 }
994 996
995 void AppWindow::Observe(int type, 997 void AppWindow::Observe(int type,
996 const content::NotificationSource& source, 998 const content::NotificationSource& source,
997 const content::NotificationDetails& details) { 999 const content::NotificationDetails& details) {
998 switch (type) { 1000 switch (type) {
999 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { 1001 case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
1000 const extensions::Extension* unloaded_extension = 1002 const extensions::Extension* unloaded_extension =
1001 content::Details<extensions::UnloadedExtensionInfo>(details) 1003 content::Details<extensions::UnloadedExtensionInfo>(details)
1002 ->extension; 1004 ->extension;
1003 if (extension_id_ == unloaded_extension->id()) 1005 if (extension_id_ == unloaded_extension->id())
1004 native_app_window_->Close(); 1006 native_app_window_->Close();
1005 break; 1007 break;
1006 } 1008 }
1007 case chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: { 1009 case extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: {
1008 const extensions::Extension* installed_extension = 1010 const extensions::Extension* installed_extension =
1009 content::Details<const extensions::InstalledExtensionInfo>(details) 1011 content::Details<const extensions::InstalledExtensionInfo>(details)
1010 ->extension; 1012 ->extension;
1011 DCHECK(installed_extension); 1013 DCHECK(installed_extension);
1012 if (installed_extension->id() == extension_id()) 1014 if (installed_extension->id() == extension_id())
1013 native_app_window_->UpdateShelfMenu(); 1015 native_app_window_->UpdateShelfMenu();
1014 break; 1016 break;
1015 } 1017 }
1016 case chrome::NOTIFICATION_APP_TERMINATING: 1018 case chrome::NOTIFICATION_APP_TERMINATING:
1017 native_app_window_->Close(); 1019 native_app_window_->Close();
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 region.bounds.x(), 1154 region.bounds.x(),
1153 region.bounds.y(), 1155 region.bounds.y(),
1154 region.bounds.right(), 1156 region.bounds.right(),
1155 region.bounds.bottom(), 1157 region.bounds.bottom(),
1156 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); 1158 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
1157 } 1159 }
1158 return sk_region; 1160 return sk_region;
1159 } 1161 }
1160 1162
1161 } // namespace apps 1163 } // namespace apps
OLDNEW
« no previous file with comments | « apps/app_restore_service_browsertest.cc ('k') | apps/saved_files_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698