OLD | NEW |
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/extensions/extension_tabs_module.h" | 5 #include "chrome/browser/extensions/extension_tabs_module.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "content/public/browser/render_view_host.h" | 56 #include "content/public/browser/render_view_host.h" |
57 #include "content/public/browser/render_view_host_delegate.h" | 57 #include "content/public/browser/render_view_host_delegate.h" |
58 #include "content/public/browser/web_contents.h" | 58 #include "content/public/browser/web_contents.h" |
59 #include "content/public/browser/web_contents_view.h" | 59 #include "content/public/browser/web_contents_view.h" |
60 #include "skia/ext/image_operations.h" | 60 #include "skia/ext/image_operations.h" |
61 #include "skia/ext/platform_canvas.h" | 61 #include "skia/ext/platform_canvas.h" |
62 #include "third_party/skia/include/core/SkBitmap.h" | 62 #include "third_party/skia/include/core/SkBitmap.h" |
63 #include "ui/gfx/codec/jpeg_codec.h" | 63 #include "ui/gfx/codec/jpeg_codec.h" |
64 #include "ui/gfx/codec/png_codec.h" | 64 #include "ui/gfx/codec/png_codec.h" |
65 | 65 |
66 #if defined(USE_AURA) | 66 #if defined(USE_ASH) |
67 #include "ash/ash_switches.h" | 67 #include "ash/ash_switches.h" |
68 #include "base/command_line.h" | 68 #include "base/command_line.h" |
69 #include "chrome/browser/ui/views/ash/panel_view_aura.h" | 69 #include "chrome/browser/ui/views/ash/panel_view_aura.h" |
70 #endif | 70 #endif |
71 | 71 |
72 namespace Get = extensions::api::windows::Get; | 72 namespace Get = extensions::api::windows::Get; |
73 namespace GetAll = extensions::api::windows::GetAll; | 73 namespace GetAll = extensions::api::windows::GetAll; |
74 namespace GetCurrent = extensions::api::windows::GetCurrent; | 74 namespace GetCurrent = extensions::api::windows::GetCurrent; |
75 namespace GetLastFocused = extensions::api::windows::GetLastFocused; | 75 namespace GetLastFocused = extensions::api::windows::GetLastFocused; |
76 namespace errors = extension_manifest_errors; | 76 namespace errors = extension_manifest_errors; |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 &type_str)); | 569 &type_str)); |
570 if (type_str == keys::kWindowTypeValuePopup) { | 570 if (type_str == keys::kWindowTypeValuePopup) { |
571 window_type = Browser::TYPE_POPUP; | 571 window_type = Browser::TYPE_POPUP; |
572 extension_id = GetExtension()->id(); | 572 extension_id = GetExtension()->id(); |
573 } else if (type_str == keys::kWindowTypeValuePanel) { | 573 } else if (type_str == keys::kWindowTypeValuePanel) { |
574 extension_id = GetExtension()->id(); | 574 extension_id = GetExtension()->id(); |
575 bool use_panels = false; | 575 bool use_panels = false; |
576 #if !defined(OS_ANDROID) | 576 #if !defined(OS_ANDROID) |
577 use_panels = PanelManager::ShouldUsePanels(extension_id); | 577 use_panels = PanelManager::ShouldUsePanels(extension_id); |
578 #endif | 578 #endif |
579 #if defined(USE_AURA) | 579 #if defined(USE_ASH) |
580 if (CommandLine::ForCurrentProcess()->HasSwitch( | 580 if (CommandLine::ForCurrentProcess()->HasSwitch( |
581 ash::switches::kAuraPanelManager)) | 581 ash::switches::kAuraPanelManager)) |
582 use_panels = true; | 582 use_panels = true; |
583 #endif | 583 #endif |
584 if (use_panels) | 584 if (use_panels) |
585 window_type = Browser::TYPE_PANEL; | 585 window_type = Browser::TYPE_PANEL; |
586 else | 586 else |
587 window_type = Browser::TYPE_POPUP; | 587 window_type = Browser::TYPE_POPUP; |
588 } else if (type_str != keys::kWindowTypeValueNormal) { | 588 } else if (type_str != keys::kWindowTypeValueNormal) { |
589 error_ = keys::kInvalidWindowTypeError; | 589 error_ = keys::kInvalidWindowTypeError; |
590 return false; | 590 return false; |
591 } | 591 } |
592 } | 592 } |
593 } | 593 } |
594 | 594 |
595 #if defined(USE_AURA) | 595 #if defined(USE_ASH) |
596 // Aura Panels create a new PanelViewAura. | 596 // Aura Panels create a new PanelViewAura. |
597 if (CommandLine::ForCurrentProcess()->HasSwitch( | 597 if (CommandLine::ForCurrentProcess()->HasSwitch( |
598 ash::switches::kAuraPanelManager) && | 598 ash::switches::kAuraPanelManager) && |
599 window_type == Browser::TYPE_PANEL) { | 599 window_type == Browser::TYPE_PANEL) { |
600 // Note: Panels ignore all but the first url provided. | 600 // Note: Panels ignore all but the first url provided. |
601 std::string title = | 601 std::string title = |
602 web_app::GenerateApplicationNameFromExtensionId(extension_id); | 602 web_app::GenerateApplicationNameFromExtensionId(extension_id); |
603 PanelViewAura* panel_view = new PanelViewAura(title); | 603 PanelViewAura* panel_view = new PanelViewAura(title); |
604 panel_view->Init(window_profile, urls[0], panel_bounds); | 604 panel_view->Init(window_profile, urls[0], panel_bounds); |
605 result_.reset( | 605 result_.reset( |
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 // called for every API call the extension made. | 1812 // called for every API call the extension made. |
1813 GotLanguage(language); | 1813 GotLanguage(language); |
1814 } | 1814 } |
1815 | 1815 |
1816 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1816 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
1817 result_.reset(Value::CreateStringValue(language.c_str())); | 1817 result_.reset(Value::CreateStringValue(language.c_str())); |
1818 SendResponse(true); | 1818 SendResponse(true); |
1819 | 1819 |
1820 Release(); // Balanced in Run() | 1820 Release(); // Balanced in Run() |
1821 } | 1821 } |
OLD | NEW |