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

Side by Side Diff: visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PluginDebuggerVS.cs

Issue 10836143: Refactored the VS add-in (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 namespace NativeClientVSAddIn
6 {
7 using System;
8
9 using EnvDTE80;
10
11 /// <summary>
12 /// This class handles the details of finding a pepper plugin and attaching to it.
13 /// </summary>
14 public class PluginDebuggerVS : PluginDebuggerBase
15 {
16 /// <summary>
17 /// Path to the actual plug-in assembly.
18 /// </summary>
19 private string pluginAssembly_;
20
21 /// <summary>
22 /// Constructs the PluginDebuggerHelper.
23 /// Object is not usable until LoadProjectSettings() is called.
24 /// </summary>
25 /// <param name="dte">Automation object from Visual Studio.</param>
26 /// <param name="properties">PropertyManager pointing to a valid project/pla tform.</param>
27 public PluginDebuggerVS(DTE2 dte, PropertyManager properties)
28 : base(dte, properties)
29 {
30 pluginAssembly_ = properties.PluginAssembly;
31 PluginFoundEvent += new EventHandler<PluginFoundEventArgs>(Attach);
32 }
33
34 /// <summary>
35 /// Called to check if a process is a valid plugin to attach to.
36 /// </summary>
37 /// <param name="proc">Contains information about the process in question.</ param>
38 /// <param name="mainChromeFlags">Flags on the main Chrome process.</param>
39 /// <returns>True if we should attach to the process.</returns>
40 protected override bool IsPluginProcess(ProcessInfo proc, string mainChromeF lags)
41 {
42 StringComparison ignoreCase = StringComparison.InvariantCultureIgnoreCase;
43 string identifierFlagTarget =
44 string.Format(Strings.PepperProcessPluginFlagFormat, pluginAssembl y_);
45 return proc.Name.Equals(Strings.ChromeProcessName, ignoreCase) &&
46 proc.CommandLine.Contains(Strings.ChromeRendererFlag, ignoreCase) & &
47 proc.CommandLine.Contains(identifierFlagTarget, ignoreCase);
48 }
49
50 /// <summary>
51 /// Attaches the Visual Studio debugger to the given process ID.
52 /// </summary>
53 /// <param name="src">The parameter is not used.</param>
54 /// <param name="args">Contains the process ID to attach to.</param>
55 private void Attach(object src, PluginFoundEventArgs args)
56 {
57 foreach (EnvDTE.Process proc in Dte.Debugger.LocalProcesses)
58 {
59 if (proc.ProcessID == args.ProcessID)
60 {
61 proc.Attach();
62 break;
63 }
64 }
65 }
66 }
67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698